import sys
import numpy as np
import math
# for AtCoder
# import fractions
from collections import deque 
from functools import reduce

# input = sys.stdin.readline

n = int(input())

sum = 0
for i in range(1, n+1):
    if ((i % 3) == 0 or (i % 5) == 0):
        continue
    else:
        sum += i
    
print(sum)