a, b, c, d = map(int, input().split()) lr = [i for i in range(a, b+1)] lb = [i for i in range(c, d+1)] print(len(lr)*len(lb) - (len(lr+lb) - len(set(lr+lb))))