#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int a, b, c, d; cin >> a >> b >> c >> d;
  int x = max(min(b, d) - max(a, c) + 1, 0);
  int res = (b - a + 1) * (d - c + 1) - x;
  cout << res << '\n';
}