#include using namespace std; int main() { int a, b, c, d, p = 0; cin >> a >> b >> c >> d; int acmax = (a > c ? a : c), bdmin = (b < d ? b : d); if(bdmin - acmax >= 0) p += bdmin - acmax + 1; cout << (b - a + 1) * (d - c + 1) - p << endl; return 0; }