n = int(eval(input()))



a = []

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

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

        a.append(i)



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

a= [i for i in range(1, n+1) 

   if i % 3 != 0 and i % 5 != 0 and i % 15 != 0]

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

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

-a = [] -for i in range(1, n + 1): -    if (i % 3 != 0) and (i % 5 != 0): -        a.append(i) +a = [i for i in range(1, n + 1) if i % 3 != 0 and i % 5 != 0 and i % 15 != 0]