def run(): A, B, C, D = [int(x) for x in input().split()] X = B - A + 1 Y = D - C + 1 if B < C or D < A: Z = 0 else: Z = B - C if D > A else D - A print(X * Y - Z) if __name__ == '__main__': run()