#include using namespace std; int main(){ cin.tie(0),ios::sync_with_stdio(false); int a,b,c,d; cin>>a>>b>>c>>d; int diff=min(b,d)-max(a,c)+1; cout<<(diff<0?(b-a+1)*(d-c+1):abs((b-a+1-diff)*(d-c+1))+diff*(d-c))<<"\n"s; }