import sys, math

from itertools import permutations, combinations

from collections import defaultdict, Counter, deque

from math import factorial#, gcd

from bisect import bisect_left #bisect_left(list, value)

sys.setrecursionlimit(10**7)

enu = enumerate

MOD = 10**9+7

def input(): return sys.stdin.readline()[:-1]

def pri(x): print(('\n'.join(map(str, x))))



N = int(eval(input()))



fb = []

for i in range(1, N+1):

    if i%3==0 or i%5==0:

        fb.append(0)

    else:

        fb.append(i)

print((sum(fb)))





import sys, math

from itertools import permutations, combinations

from collections import defaultdict, Counter, deque

from math import factorial#, gcd

from bisect import bisect_left #bisect_left(list, value)

sys.setrecursionlimit(10**7)

enu = enumerate

MOD = 10**9+7

def input(): return sys.stdin.readline()[:-1]

def pri(x): print(('\n'.join(map(str, x))))



N = int(eval(input()))



cnt = 0

for i in range(1, N+1):

    if i%3==0 or i%5==0:

        pass

    else:

        cnt += i

print(cnt)
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial  # , gcd
from bisect import bisect_left  # bisect_left(list, value)

sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9 + 7


def input():
    return sys.stdin.readline()[:-1]


def pri(x):
    print(("\n".join(map(str, x))))


N = int(eval(input()))
fb = []
for i in range(1, N + 1):
    if i % 3 == 0 or i % 5 == 0:
        fb.append(0)
    else:
        fb.append(i)
print((sum(fb)))

import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial  # , gcd
from bisect import bisect_left  # bisect_left(list, value)

sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9 + 7


def input():
    return sys.stdin.readline()[:-1]


def pri(x):
    print(("\n".join(map(str, x))))


N = int(eval(input()))
cnt = 0
for i in range(1, N + 1):
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        cnt += i
print(cnt)

-fb = [] +cnt = 0 -        fb.append(0) +        pass -        fb.append(i) -print((sum(fb))) +        cnt += i +print(cnt)