n = int(eval(input()))

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

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

-print((n * (n - 1) // 2)) +print(n * ~-n / 2)