
N = int(input())

dammy=[]
for i in range(1,N+1):
    if i%3==0 and i%5==0:
        #dammy.append('FizzBuzz')
        continue
    elif i%3==0:
        #dammy.append('Fizz')
        continue
    elif i%5==0:
        #dammy.append('Buzz')
        continue
    else:
        dammy.append(i)

print(sum(dammy))