first = input().split() A = int(first[0]) B = int(first[1]) C = int(first[2]) D = int(first[3]) ABrange = B - A + 1 CDrange = D - C + 1 ans = ABrange*CDrange if ((A>C)and(DC)and(D D :# double = D - A +1 n = (ABrange - double) * CDrange m = double * (CDrange - double) ans = n+ m elif B < D : double = B - C +1 n = (CDrange - double) * ABrange m = double * (ABrange - double) ans = n+ m print(ans)