N = int(eval(input()))

a = 0

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

    if i % 5 != 0 and i % 3 != 0:

        a += i

print(a)

N = int(eval(input()))

print((sum([i for i in range(1, N+1) if i%5!=0 and i%3!=0])))
N = int(eval(input()))
a = 0
for i in range(1, N + 1):
    if i % 5 != 0 and i % 3 != 0:
        a += i
print(a)

N = int(eval(input()))
print((sum([i for i in range(1, N + 1) if i % 5 != 0 and i % 3 != 0])))

-a = 0 -for i in range(1, N + 1): -    if i % 5 != 0 and i % 3 != 0: -        a += i -print(a) +print((sum([i for i in range(1, N + 1) if i % 5 != 0 and i % 3 != 0])))