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