from math import floor

N = int(eval(input()))



S = int((N * (N+1)) / 2)



fizz = floor(N/3)

buzz = floor(N/5)

fizzbuzz = floor(N/15)

print((S - int(3 * fizz * (fizz+1)/2) -

          int(5*buzz*(buzz+1) /2) +

          int(15 * fizzbuzz * (fizzbuzz+1)/2)))
from math import floor

def sum(x):

    return int(x *(x+1)/2)

N = int(eval(input()))



S = sum(N)



fizz = floor(N/3)

buzz = floor(N/5)

fizzbuzz = floor(N/15)

print((S - 3 * sum(fizz) - 5*sum(buzz) + 15 * sum(fizzbuzz)))
from math import floor

N = int(eval(input()))
S = int((N * (N + 1)) / 2)
fizz = floor(N / 3)
buzz = floor(N / 5)
fizzbuzz = floor(N / 15)
print(
    (
        S
        - int(3 * fizz * (fizz + 1) / 2)
        - int(5 * buzz * (buzz + 1) / 2)
        + int(15 * fizzbuzz * (fizzbuzz + 1) / 2)
    )
)

from math import floor


def sum(x):
    return int(x * (x + 1) / 2)


N = int(eval(input()))
S = sum(N)
fizz = floor(N / 3)
buzz = floor(N / 5)
fizzbuzz = floor(N / 15)
print((S - 3 * sum(fizz) - 5 * sum(buzz) + 15 * sum(fizzbuzz)))

+ +def sum(x): +    return int(x * (x + 1) / 2) + + -S = int((N * (N + 1)) / 2) +S = sum(N) -print( -    ( -        S -        - int(3 * fizz * (fizz + 1) / 2) -        - int(5 * buzz * (buzz + 1) / 2) -        + int(15 * fizzbuzz * (fizzbuzz + 1) / 2) -    ) -) +print((S - 3 * sum(fizz) - 5 * sum(buzz) + 15 * sum(fizzbuzz)))