# 入力N

N = int(eval(input()))



ary2 = []



for x in list(range(1, N + 1, 1)):

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

        ary2.append(x)



print((sum(ary2)))
# 入力N

N = int(eval(input()))



ans = 0



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

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

        ans += x



print(ans)
# 入力N
N = int(eval(input()))
ary2 = []
for x in list(range(1, N + 1, 1)):
    if x % 3 != 0 and x % 5 != 0:
        ary2.append(x)
print((sum(ary2)))

# 入力N
N = int(eval(input()))
ans = 0
for x in range(1, N + 1):
    if x % 3 != 0 and x % 5 != 0:
        ans += x
print(ans)

-ary2 = [] -for x in list(range(1, N + 1, 1)): +ans = 0 +for x in range(1, N + 1): -        ary2.append(x) -print((sum(ary2))) +        ans += x +print(ans)