N = int(input())

is_Fizz = lambda number: number % 3 == 0
is_Buzz = lambda number: number % 5 == 0

answer = 0
for i in range(N + 1):
    if is_Fizz(i) or is_Buzz(i): continue
    
    answer += i

print(answer)
