N = int(eval(input()))

ans = sum(range(1, N))

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

ans = N * (N - 1) // 2

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

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

-ans = sum(range(1, N)) +ans = N * (N - 1) // 2