a=0

for i in range(int(eval(input()))+1):

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

        a+=i

print(a)
n=int(eval(input()))

a=[0,1,3,3,7,7,7,14,22,22,22,33,33,46,60]

b=[0,1,1,0,1,0,0,1,1,0,0,1,0,1,1]

print((60*(n//15)+120*(n//15)*(n//15-1)//2+sum(b[:n%15+1])*(15*(n//15))+a[n%15]))
a = 0
for i in range(int(eval(input())) + 1):
    if i % 3 != 0 and i % 5 != 0:
        a += i
print(a)

n = int(eval(input()))
a = [0, 1, 3, 3, 7, 7, 7, 14, 22, 22, 22, 33, 33, 46, 60]
b = [0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1]
print(
    (
        60 * (n // 15)
        + 120 * (n // 15) * (n // 15 - 1) // 2
        + sum(b[: n % 15 + 1]) * (15 * (n // 15))
        + a[n % 15]
    )
)

-a = 0 -for i in range(int(eval(input())) + 1): -    if i % 3 != 0 and i % 5 != 0: -        a += i -print(a) +n = int(eval(input())) +a = [0, 1, 3, 3, 7, 7, 7, 14, 22, 22, 22, 33, 33, 46, 60] +b = [0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1] +print( +    ( +        60 * (n // 15) +        + 120 * (n // 15) * (n // 15 - 1) // 2 +        + sum(b[: n % 15 + 1]) * (15 * (n // 15)) +        + a[n % 15] +    ) +)