n = int(eval(input()))

c = 0

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

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

    c += i

print(c)
n = int(eval(input()))

l = [i for i in range(1,n+1) if i%3 != 0 and i%5 != 0]

print((sum(l)))
n = int(eval(input()))
c = 0
for i in range(1, n + 1):
    if i % 3 != 0 and i % 5 != 0:
        c += i
print(c)

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

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