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 = min([B - C, D - A]) + 1 print(X * Y - Z) if __name__ == '__main__': run()