N = int(eval(input()))

l = [i for i in range(1, N + 1)]

s = []

for i in l:

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

        s.append(i)

print((sum(s)))

N = int(eval(input()))

l = [i for i in range(1, N + 1)]



s = 0

for i in l:

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

        s += i

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

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

-s = [] +s = 0 -        s.append(i) -print((sum(s))) +        s += i +print(s)