#include using namespace std; using lint = long long; template using V = vector; template using VV = V< V >; 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'; }