N = int(eval(input()))



l = []

for i in range(N+1):

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

        l.append(i)

print((sum(l)))
N = int(eval(input()))

l = [i for i in range(N+1)  if not i % 3 == 0 and not i % 5 == 0]

print((sum(l)))
N = int(eval(input()))
l = []
for i in range(N + 1):
    if not i % 3 == 0 and not i % 5 == 0:
        l.append(i)
print((sum(l)))

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

-l = [] -for i in range(N + 1): -    if not i % 3 == 0 and not i % 5 == 0: -        l.append(i) +l = [i for i in range(N + 1) if not i % 3 == 0 and not i % 5 == 0]