n = int(eval(input()))



l = []

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

  if i % 3 == 0:

    continue

  elif i % 5 == 0:

    continue

  else:

    l.append(i)



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



l = 0

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

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

    continue

  else:

    l+=i

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

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

-l = [] +l = 0 -    if i % 3 == 0: -        continue -    elif i % 5 == 0: +    if i % 3 == 0 or i % 5 == 0: -        l.append(i) -print((sum(l))) +        l += i +print(l)