import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

import numpy as np



N = int(read())

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

x[x % 3 == 0] = 0

x[x % 5 == 0] = 0

print((x.sum()))

import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

import numpy as np



N = int(read())

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

x[::3] = 0

x[::5] = 0

print((x.sum()))

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

N = int(read())
x = np.arange(1, N + 1, dtype=np.int64)
x[x % 3 == 0] = 0
x[x % 5 == 0] = 0
print((x.sum()))

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

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

-x = np.arange(1, N + 1, dtype=np.int64) -x[x % 3 == 0] = 0 -x[x % 5 == 0] = 0 +x = np.arange(N + 1, dtype=np.int64) +x[::3] = 0 +x[::5] = 0