N = eval(input())

count :int=0

for k in range(int(N)):

  if (k+1)%3!=0 and (k+1)%5!=0:

    count+=(k+1)

print(count)
n=int(eval(input()))

ans=0

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

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

    ans+=i

print(ans)
N = eval(input())
count: int = 0
for k in range(int(N)):
    if (k + 1) % 3 != 0 and (k + 1) % 5 != 0:
        count += k + 1
print(count)

n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)

-N = eval(input()) -count: int = 0 -for k in range(int(N)): -    if (k + 1) % 3 != 0 and (k + 1) % 5 != 0: -        count += k + 1 -print(count) +n = int(eval(input())) +ans = 0 +for i in range(1, n + 1): +    if i % 3 != 0 and i % 5 != 0: +        ans += i +print(ans)