a,b,c,d = map(int, input().split()) b += 1; d += 1 s = abs((b-a)*(d-c)) t = len(set(range(a,b)) & set(range(c,d))) print(s-t)