import sys
import math
import collections
from collections import deque
import heapq
n = int(input())
#n, k = map(int, sys.stdin.readline().split())
#s = input()
#a = list(map(int, sys.stdin.readline().split()))

a = 0
for i in range(1, n+1):
    if i % 3 == 0:
        continue
    if i % 5 == 0:
        continue

    a += i

print(a)




    
