#include #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define vec_input(v) for(auto it=v.begin();it!=v.end();it++){cin>>*it;} #define vec_output(v) for(auto it=v.begin();it!=v.end();it++){if(it!=v.begin())cout<<" ";cout<<*it;}cout<T digitsum(T n); template bool isPrime(T n); template vector> prime_factor(T n); long long int intpow(long long int,long long int); template T intlog(T); long long int combination(long long int,long long int); long long int arith_sum1(long long int,long long int,long long int); long long int arith_sum2(long long int,long long int,long long int); long long int series_sum(long long int); int main(){ int a,b,c,d,def=0; cin>>a>>b>>c>>d; if(b>=c&&b<=d)def=b-c+1; else if(d>=a&&d<=b)def=d-a+1; cout<<(b-a+1)*(d-c+1)-def<