N = int(eval(input()))

print((sum(range(1, N))))
n=int(eval(input()))

print(((n-1)*n//2))
N = int(eval(input()))
print((sum(range(1, N))))

n = int(eval(input()))
print(((n - 1) * n // 2))

-N = int(eval(input())) -print((sum(range(1, N)))) +n = int(eval(input())) +print(((n - 1) * n // 2))