# 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()))

print((sum(i for i in range(1, n + 1) if i % 3 and i % 5)))
# 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()))
print((sum(i for i in range(1, n + 1) if i % 3 and i % 5)))

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