a=int(eval(input()))

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

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

a = int(eval(input()))
print((a * a - a >> 1))

-print((a * (a - 1) // 2)) +print((a * a - a >> 1))