n, m = map(int, input().split())
large = m if m >= n else n
small = m if m < n else n
sum = 0
for i in range(small, large + 1):
sum += i
print(sum)
n, m = map(int, input().split())
max_ = max(n, m)
min_ = min(n, m)
d = max_ - min_
sum = (d * (d + 1))//2
print(sum + min_ * (d + 1))