N = int(eval(input()))



amount = 0



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

    is_fizzbuzz = (i % 3 == 0) or (i % 5 == 0)



    if not is_fizzbuzz:

        amount += i



print(amount)

n = int(eval(input()))

summation = 0



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

    

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

        summation += i



print(summation)

N = int(eval(input()))
amount = 0
for i in range(1, N + 1):
    is_fizzbuzz = (i % 3 == 0) or (i % 5 == 0)
    if not is_fizzbuzz:
        amount += i
print(amount)

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

-N = int(eval(input())) -amount = 0 -for i in range(1, N + 1): -    is_fizzbuzz = (i % 3 == 0) or (i % 5 == 0) -    if not is_fizzbuzz: -        amount += i -print(amount) +n = int(eval(input())) +summation = 0 +for i in range(1, n + 1): +    if (i % 3 != 0) and (i % 5 != 0): +        summation += i +print(summation)