n=int(eval(input()))

ans=0

def fb(num):

    if num%3==0 or num%5==0:

        return False 

    else:

        return True

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

    if fb(i):

        ans+=i

print(ans)



n=int(eval(input()))

def func():

    s=0

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

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

            s+=i

        else:

            continue 

    return s

print((func()))

n = int(eval(input()))
ans = 0


def fb(num):
    if num % 3 == 0 or num % 5 == 0:
        return False
    else:
        return True


for i in range(1, n + 1):
    if fb(i):
        ans += i
print(ans)

n = int(eval(input()))


def func():
    s = 0
    for i in range(1, n + 1):
        if not (i % 3 == 0 or i % 5 == 0):
            s += i
        else:
            continue
    return s


print((func()))

-ans = 0 -def fb(num): -    if num % 3 == 0 or num % 5 == 0: -        return False -    else: -        return True +def func(): +    s = 0 +    for i in range(1, n + 1): +        if not (i % 3 == 0 or i % 5 == 0): +            s += i +        else: +            continue +    return s -for i in range(1, n + 1): -    if fb(i): -        ans += i -print(ans) +print((func()))