N = int(eval(input()))

FizzBuzz = []

Fizz = []

Buzz = []

ano = []

plus = 0

for i in range(N+1):

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

        FizzBuzz.append(i)

    elif i % 3 == 0:

        Fizz.append(i)

    elif i % 5 == 0:

        Buzz.append(i)

    else:

        ano.append(i)

for a in ano:

    plus += a



print(plus)
N = int(eval(input()))

none_num = [i for i in range(1, N+1) if i%3 != 0 and i%5 != 0]

none = sum(none_num)

print(none)
N = int(eval(input()))
FizzBuzz = []
Fizz = []
Buzz = []
ano = []
plus = 0
for i in range(N + 1):
    if i % 3 == 0 and i % 5 == 0:
        FizzBuzz.append(i)
    elif i % 3 == 0:
        Fizz.append(i)
    elif i % 5 == 0:
        Buzz.append(i)
    else:
        ano.append(i)
for a in ano:
    plus += a
print(plus)

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

-FizzBuzz = [] -Fizz = [] -Buzz = [] -ano = [] -plus = 0 -for i in range(N + 1): -    if i % 3 == 0 and i % 5 == 0: -        FizzBuzz.append(i) -    elif i % 3 == 0: -        Fizz.append(i) -    elif i % 5 == 0: -        Buzz.append(i) -    else: -        ano.append(i) -for a in ano: -    plus += a -print(plus) +none_num = [i for i in range(1, N + 1) if i % 3 != 0 and i % 5 != 0] +none = sum(none_num) +print(none)