#include using namespace std; typedef long long ll; typedef pair l_l; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) //const ll mod = 1000000007; int main() { //cout.precision(10); cin.tie(0); ios::sync_with_stdio(false); int a, b, c, d; cin >> a >> b >> c >> d; int same = min(b, d) - max(a, c) + 1; if(a > d || c > b) same = 0; cout << (b - a + 1) * (d - c + 1) - same << endl; return 0; }