a=int(eval(input()))

x=int(1)

s=int(0)

while x<=a:

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

        s=s+x

    x=x+1

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

s = 0

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

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

        s+=i

print(s)
a = int(eval(input()))
x = int(1)
s = int(0)
while x <= a:
    if x % 3 != 0 and x % 5 != 0:
        s = s + x
    x = x + 1
print(s)

n = int(eval(input()))
s = 0
for i in range(1, n + 1):
    if i != 3 and i != 5 and i % 3 != 0 and i % 5 != 0:
        s += i
print(s)

-a = int(eval(input())) -x = int(1) -s = int(0) -while x <= a: -    if x % 3 != 0 and x % 5 != 0: -        s = s + x -    x = x + 1 +n = int(eval(input())) +s = 0 +for i in range(1, n + 1): +    if i != 3 and i != 5 and i % 3 != 0 and i % 5 != 0: +        s += i