#include #define rep(i, n) for (int i = 0; i < n; ++i) using ll = long long; using namespace std; const int INF = 1e9; int main() { int a, b, c, d; cin >> a >> b >> c >> d; ll ans = (b - a + 1) * (d - c + 1); ans -= max(0, min(b, d) - max(a, c) + 1); cout << ans << endl; return 0; }