N = int(eval(input()))



ans = 0



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

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

    ans = ans + i



print(ans)

from functools import lru_cache



N = int(eval(input()))

 

@lru_cache(maxsize=1000)

def main(K):

    ans = 0

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

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

            ans = ans + i

    return(ans)

 

print((main(N)))
N = int(eval(input()))
ans = 0
for i in range(1, N + 1):
    if i % 15 != 0 and i % 3 != 0 and i % 5 != 0:
        ans = ans + i
print(ans)

from functools import lru_cache

N = int(eval(input()))


@lru_cache(maxsize=1000)
def main(K):
    ans = 0
    for i in range(1, N + 1):
        if i % 15 != 0 and i % 3 != 0 and i % 5 != 0:
            ans = ans + i
    return ans


print((main(N)))

+from functools import lru_cache + -ans = 0 -for i in range(1, N + 1): -    if i % 15 != 0 and i % 3 != 0 and i % 5 != 0: -        ans = ans + i -print(ans) + + +@lru_cache(maxsize=1000) +def main(K): +    ans = 0 +    for i in range(1, N + 1): +        if i % 15 != 0 and i % 3 != 0 and i % 5 != 0: +            ans = ans + i +    return ans + + +print((main(N)))