#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 = 0; for (int i = a; i <= b; i++) { for (int j = c; j <= d; j++) { if (i == j) continue; else ans++; } } cout << ans << endl; }