n = int(eval(input()))

a = []

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

    a.append(i)

new_a = [i for i in a if  i%3 != 0 and i%5 != 0]

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

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

new_a = [i for i in a if  i%3 != 0 and i%5 != 0]

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

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

-a = [] -for i in range(1, n + 1): -    a.append(i) +a = list(range(1, n + 1))