N=io.read()
a={}
for i=1, N do
    if i%3==0 and i%5==0 then
        a[i]="FizzBuzz"
    elseif i%3==0 then
        a[i]="Fizz"
    elseif i%5==0 then
        a[i]="Buzz"
    else
        a[i]=i
    end
end

sum = 0
for i=1, N do
    if type(a[i])=="number" then
        sum = sum + a[i]
    end
end
print(sum)