a,b,c,d=map(int,input().split()) print((b-a+1)*(d-c+1)-(max(min(d,b)-max(a,c)+1,0)))