N = int(eval(input()))

s = 0

i = 1

while i <= N:

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

        s += i

    i += 1

print(s)
N = int(eval(input()))

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

s = sum(l)

print(s)
N = int(eval(input()))
s = 0
i = 1
while i <= N:
    if i % 3 != 0 and i % 5 != 0:
        s += i
    i += 1
print(s)

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

-s = 0 -i = 1 -while i <= N: -    if i % 3 != 0 and i % 5 != 0: -        s += i -    i += 1 +l = [i for i in range(1, N + 1) if i % 3 != 0 and i % 5 != 0] +s = sum(l)