n = int(eval(input()))

A = list(range(1, n+1))

B = list()

for i in range(1, n+1):

    if i % 5 == 0 or i % 3 == 0:

        B.append(i)

ans = list(set(A) - set(B))

print((sum(ans)))
n = int(eval(input()))



n3 = n // 3

n5 = n // 5

n15 = n // 15



print((n*(n + 1)//2 - 3*n3*(n3 + 1)//2 - 5*n5*(n5 + 1)//2 + 15*n15*(n15 + 1)//2))
n = int(eval(input()))
A = list(range(1, n + 1))
B = list()
for i in range(1, n + 1):
    if i % 5 == 0 or i % 3 == 0:
        B.append(i)
ans = list(set(A) - set(B))
print((sum(ans)))

n = int(eval(input()))
n3 = n // 3
n5 = n // 5
n15 = n // 15
print(
    (
        n * (n + 1) // 2
        - 3 * n3 * (n3 + 1) // 2
        - 5 * n5 * (n5 + 1) // 2
        + 15 * n15 * (n15 + 1) // 2
    )
)

-A = list(range(1, n + 1)) -B = list() -for i in range(1, n + 1): -    if i % 5 == 0 or i % 3 == 0: -        B.append(i) -ans = list(set(A) - set(B)) -print((sum(ans))) +n3 = n // 3 +n5 = n // 5 +n15 = n // 15 +print( +    ( +        n * (n + 1) // 2 +        - 3 * n3 * (n3 + 1) // 2 +        - 5 * n5 * (n5 + 1) // 2 +        + 15 * n15 * (n15 + 1) // 2 +    ) +)