from decimal import *



N = int(eval(input()))

# if N == 1:

#     print("0")

#     exit()

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

print((int(ans)))





N = int(eval(input()))

# if N == 1:

#     print("0")

#     exit()

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

print((int(ans)))

from decimal import *

N = int(eval(input()))
# if N == 1:
#     print("0")
#     exit()
ans = Decimal((Decimal(N - 1) * Decimal(N) / 2))
print((int(ans)))

N = int(eval(input()))
# if N == 1:
#     print("0")
#     exit()
ans = (N - 1) * N // 2
print((int(ans)))

-from decimal import * - -ans = Decimal((Decimal(N - 1) * Decimal(N) / 2)) +ans = (N - 1) * N // 2