N=int(eval(input()))

a=[]

z=0

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

    if i%3==0:

        z=0

    elif i%5==0:

        z=0

    elif i%3==0 and i%5==0:

        z=0

    else:

        a.append(i)

print((sum(a)))
N=int(eval(input()))

count=[]

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

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

        count.append(i)

print((sum(count))) 
N = int(eval(input()))
a = []
z = 0
for i in range(1, N + 1):
    if i % 3 == 0:
        z = 0
    elif i % 5 == 0:
        z = 0
    elif i % 3 == 0 and i % 5 == 0:
        z = 0
    else:
        a.append(i)
print((sum(a)))

N = int(eval(input()))
count = []
for i in range(1, N + 1):
    if i % 3 != 0 and i % 5 != 0:
        count.append(i)
print((sum(count)))

-a = [] -z = 0 +count = [] -    if i % 3 == 0: -        z = 0 -    elif i % 5 == 0: -        z = 0 -    elif i % 3 == 0 and i % 5 == 0: -        z = 0 -    else: -        a.append(i) -print((sum(a))) +    if i % 3 != 0 and i % 5 != 0: +        count.append(i) +print((sum(count)))