N=int(eval(input()))

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

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

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

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

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