N = int(eval(input()))



def fizz_buzz(n):

  return 0 if n % 5 == 0 or n % 3 == 0 else n



print((sum(

  fizz_buzz(i)

  for i in range(1, N + 1)

)))
N = int(eval(input()))



print((sum(

  i

  for i in range(1, N + 1)

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

)))

N = int(eval(input()))


def fizz_buzz(n):
    return 0 if n % 5 == 0 or n % 3 == 0 else n


print((sum(fizz_buzz(i) for i in range(1, N + 1))))

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

- - -def fizz_buzz(n): -    return 0 if n % 5 == 0 or n % 3 == 0 else n - - -print((sum(fizz_buzz(i) for i in range(1, N + 1)))) +print((sum(i for i in range(1, N + 1) if i % 3 != 0 and i % 5 != 0)))