#include using namespace std; using ll = long long; using P = pair; using PL = pair; // Welcome to my source code! int main() { int a, b, c, d; cin >> a >> b >> c >> d; ll ans = (b - a + 1) * (d - c + 1); if (b >= c) ans -= max(0, (min(b, d) - max(a, c) + 1)); cout << ans << endl; }