n=int(input())

a=[]
for i in range(n):
    if i%3==0 and i%5==0:
        a.append('FizzBuzz')
    elif i%3==0:
        a.append('Fizz')
    elif i%5==0:
        a.append('Buzz')
    else:
        a.append(i)

sum=0
for ai in a:
    if type(ai) is int:
        sum=sum+ai

print(sum)
