n = int(eval(input()))

sum = 0

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

    if i % 3 != 0 and i % 5 != 0:

        sum += i

print(sum)
# maspy 入力input() ver.

import numpy as np

n = int(eval(input()))

x = np.arange(n + 1, dtype=np.int64)

x[::3] = 0

x[::5] = 0

print((x.sum()))
n = int(eval(input()))
sum = 0
for i in range(1, n + 1):
    if i % 3 != 0 and i % 5 != 0:
        sum += i
print(sum)

# maspy 入力input() ver.
import numpy as np

n = int(eval(input()))
x = np.arange(n + 1, dtype=np.int64)
x[::3] = 0
x[::5] = 0
print((x.sum()))

+# maspy 入力input() ver. +import numpy as np + -sum = 0 -for i in range(1, n + 1): -    if i % 3 != 0 and i % 5 != 0: -        sum += i -print(sum) +x = np.arange(n + 1, dtype=np.int64) +x[::3] = 0 +x[::5] = 0 +print((x.sum()))