import numpy as np

N = int(eval(input()))

list_num = np.arange(1, N+1)



for i in list_num:

  if i % 3 == 0:

    list_num[i-1] = 0

  elif i % 5 == 0:

    list_num[i-1] = 0

  elif i % 15 == 0:

    list_num[i-1] = 0



print((list_num.sum()))
import sys

import numpy as np



read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



N = int(read())



ans = np.arange(N+1, dtype=np.int64)

ans[::3] = 0

ans[::5] = 0



print((ans.sum()))
import numpy as np

N = int(eval(input()))
list_num = np.arange(1, N + 1)
for i in list_num:
    if i % 3 == 0:
        list_num[i - 1] = 0
    elif i % 5 == 0:
        list_num[i - 1] = 0
    elif i % 15 == 0:
        list_num[i - 1] = 0
print((list_num.sum()))

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(read())
ans = np.arange(N + 1, dtype=np.int64)
ans[::3] = 0
ans[::5] = 0
print((ans.sum()))

+import sys -N = int(eval(input())) -list_num = np.arange(1, N + 1) -for i in list_num: -    if i % 3 == 0: -        list_num[i - 1] = 0 -    elif i % 5 == 0: -        list_num[i - 1] = 0 -    elif i % 15 == 0: -        list_num[i - 1] = 0 -print((list_num.sum())) +read = sys.stdin.buffer.read +readline = sys.stdin.buffer.readline +readlines = sys.stdin.buffer.readlines +N = int(read()) +ans = np.arange(N + 1, dtype=np.int64) +ans[::3] = 0 +ans[::5] = 0 +print((ans.sum()))