#include "bits/stdc++.h" using namespace std; #define int long long #define ll long long typedef pair<int, int> P; #define mod 1000000007 #define INF (1LL<<60) #define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i) #define YES cout << "YES" << endl; #define Yes cout << "Yes" << endl; #define NO cout << "NO" << endl; #define No cout << "No" << endl; signed main(){ int a, b, c, d; cin >> a >> b >> c >> d; int s = min(b, d) - max(a, c)+1; cout << (b - a + 1)*(d - c + 1) - max(s, 0LL); return 0; }