n = int(eval(input()))

ans = 0

for i in range(n):

    ans += i

print(ans)
n = int(eval(input()))

print((n*(n-1)//2))
n = int(eval(input()))
ans = 0
for i in range(n):
    ans += i
print(ans)

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

-ans = 0 -for i in range(n): -    ans += i -print(ans) +print((n * (n - 1) // 2))