N=int(eval(input()))

sum=0

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

    if (not i%3==0) and (not i%5==0):

        sum+=i

print(sum)
def sum(n):

    return n*(n+1)//2

N=int(eval(input()))

print((sum(N)-sum(N//3)*3-sum(N//5)*5+sum(N//15)*15))
N = int(eval(input()))
sum = 0
for i in range(1, N + 1):
    if (not i % 3 == 0) and (not i % 5 == 0):
        sum += i
print(sum)

def sum(n):
    return n * (n + 1) // 2


N = int(eval(input()))
print((sum(N) - sum(N // 3) * 3 - sum(N // 5) * 5 + sum(N // 15) * 15))

+def sum(n): +    return n * (n + 1) // 2 + + -sum = 0 -for i in range(1, N + 1): -    if (not i % 3 == 0) and (not i % 5 == 0): -        sum += i -print(sum) +print((sum(N) - sum(N // 3) * 3 - sum(N // 5) * 5 + sum(N // 15) * 15))