n=int(eval(input()))

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

print((int(ans)))

n=int(eval(input()))

ans=n*(n-1)/2 

print((int(ans)))

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

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

-ans = n * (n - 1) // 2 +ans = n * (n - 1) / 2