#include #include int main(void){ int a,b,c,d; int xxx; int ans; int min; int max; scanf("%d%d%d%d",&a,&b,&c,&d); min = (a < c)? a:c; max = (b < d)? d:b; ans = (b - a + 1)*(d - c + 1); xxx = ((b - a + 1) + (d - c + 1)) - (max - min + 1); if(xxx > 0){ ans -= xxx; } else if(a != d && b != c){ ans = max - min +1; } printf("%d",ans); }