N = int(eval(input()))

a = 0

for i in range(N):

  if (i+1)%3 != 0 and (i+1)%5 != 0:

    a += i+1

print(a)

import math

N = int(eval(input()))

S = int(N*(N+1)/2)

S -= 3*int(math.floor(N/3)*(math.floor(N/3)+1)/2)

S -= 5*int(math.floor(N/5)*(math.floor(N/5)+1)/2)

S += 15*int(math.floor(N/15)*(math.floor(N/15)+1)/2)

print(S)
N = int(eval(input()))
a = 0
for i in range(N):
    if (i + 1) % 3 != 0 and (i + 1) % 5 != 0:
        a += i + 1
print(a)

import math

N = int(eval(input()))
S = int(N * (N + 1) / 2)
S -= 3 * int(math.floor(N / 3) * (math.floor(N / 3) + 1) / 2)
S -= 5 * int(math.floor(N / 5) * (math.floor(N / 5) + 1) / 2)
S += 15 * int(math.floor(N / 15) * (math.floor(N / 15) + 1) / 2)
print(S)

+import math + -a = 0 -for i in range(N): -    if (i + 1) % 3 != 0 and (i + 1) % 5 != 0: -        a += i + 1 -print(a) +S = int(N * (N + 1) / 2) +S -= 3 * int(math.floor(N / 3) * (math.floor(N / 3) + 1) / 2) +S -= 5 * int(math.floor(N / 5) * (math.floor(N / 5) + 1) / 2) +S += 15 * int(math.floor(N / 15) * (math.floor(N / 15) + 1) / 2) +print(S)