n = int(eval(input()))

l = []

for i in range(n):

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

    l.append(i+1)

  else:

    l.append(0)

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

ans = 0

for i in range(n+1):

  if i%3 == 0 or i%5 == 0:

    ans += 0

  else:

    ans += i

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

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

-l = [] -for i in range(n): -    if (i + 1) % 3 != 0 and (i + 1) % 5 != 0: -        l.append(i + 1) +ans = 0 +for i in range(n + 1): +    if i % 3 == 0 or i % 5 == 0: +        ans += 0 -        l.append(0) -print((sum(l))) +        ans += i +print(ans)