#include #include using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; int s = b - a + 1; int t = d - c + 1; int n1 = max(a, c); int n2 = min(b, d); int n = n1 - n2; if(n > 0) { cout << s * t << endl; } else { cout << (s * t + n - 1) << endl; } }