/* No.799 赤黒かーどげぇむ https://yukicoder.me/problems/no/799 */ #include using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int a, b, c, d; int s; cin >> a >> b >> c >> d; if (a <= b && b < c && c <= d) { s = (b - a + 1) * (d - c + 1); } else if (a <= c && c <= b && b <= d) { s = (b - a + 1) * (d - c + 1) - (b - c + 1); } else if (c <= a && a <= d && d <= b) { s = (b - a + 1) * (d - c + 1) - (d - a + 1); } else { s = (b - a + 1) * (d - c + 1); } cout << s << endl; }