Problem:
 Score : 200 points    Problem Statement Let us define the FizzBuzz sequence  a_1,a_2,... as follows:   If both 3 and 5 divides i , a_i=\mbox{FizzBuzz} .  If the above does not hold but 3 divides i , a_i=\mbox{Fizz} .  If none of the above holds but 5 divides i , a_i=\mbox{Buzz} .  If none of the above holds, a_i=i .   Find the sum of all numbers among the first N terms of the FizzBuzz sequence.      Constraints  1 \leq N \leq 10^6         Input Input is given from Standard Input in the following format:  N       Output Print the sum of all numbers among the first N terms of the FizzBuzz sequence.        Sample Input 1 15      Sample Output 1 60  The first 15 terms of the FizzBuzz sequence are:  1,2,\mbox{Fizz},4,\mbox{Buzz},\mbox{Fizz},7,8,\mbox{Fizz},\mbox{Buzz},11,\mbox{Fizz},13,14,\mbox{FizzBuzz}  Among them, numbers are 1,2,4,7,8,11,13,14 , and the sum of them is 60 .       Sample Input 2 1000000      Sample Output 2 266666333332  Watch out for overflow.

Solution (Python):
n = int(input())

ans = 0

for i in range(1, n + 1):
    if i % 3 == 0:
        continue
    elif i % 5 == 0:
        continue
    else:
        ans += i

print(ans)

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

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

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

Solution (Python):
N = int(input())

result = 0

for i in range(1, N+1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        result += i

print(result)

Solution (Python):
N=int(input())

all_sum=0
for i in range(1,N+1):
    if i%3!=0 and i%5!=0:
        all_sum+=i

print(all_sum)

Solution (Python):
n=int(input())
print(sum(x for x in range(1,n+1) if x%3!=0!=x%5))

Solution (Python):
n = int(input())
sub = 0
for i in range(1, n+1):
    if i % 3 != 0:
        if i % 5 != 0:
            sub+=i
print(sub)

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N+1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    ans += i
print(ans)

Solution (Python):
def S(M):
    return M * (M + 1) // 2

N = int(input())

print(S(N) - 3 * S(N // 3) - 5 * S(N // 5) + 15 * S(N // 15))

Solution (Python):
import math
import sys
def sol(n):
    if (n % 3 == 0 or n % 5 == 0):
        return False
    return True
n = int(input())
ans = 0
for i in range(n):
    if (sol(i + 1)):
        ans += i+1
print(ans)

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

Solution (Python):
def main():
    import sys
    sys.setrecursionlimit(10 ** 6)
    input = sys.stdin.readline
    N = int(input())
    ans = 0
    for i in range(1, N+1):
        if i % 3 == 0 or i % 5 == 0:
            continue
        ans += i
    print(ans)
    

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
ans = 0
for i in range(1,n+1):
    if i%3 == 0 and i%5 == 0:
        None
    elif i%3 == 0:
        None
    elif i%5 == 0:
        None
    else:
        ans += i
print(ans)

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

Solution (Python):

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

Solution (Python):
import sys


def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())

def LI(): return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'


p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

N = II()

ans = 0
for i in range(1, N+1):
    if i%3==0 or i%5==0:
        pass
    else:
        ans+=i
print(ans)

Solution (Python):
N = int(input())

ans = 0
for i in range(1, N + 1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        ans += i

print(ans)

Solution (Python):
n = int(input())
cnt = 0

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

Solution (Python):
N = int(input())
ans = 0
for i in range(1,N+1):
    if i % 3 == 0 and i % 5 == 0:
        pass
    elif i % 3 == 0:
        pass
    elif i % 5 == 0:
        pass
    else:
        ans += i

print(ans)

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N = int(readline())

    ans = 0
    for i in range(1,N+1):
        if i % 5 == 0 or i % 3 == 0:
            continue
        else:
            ans += i

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())

total = 0
for i in range(1, n+1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    total += i
print(total)

Solution (Python):
n = int(input())

ans = 0

for i in range(1, n+1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i

print(ans)

Solution (Python):
n = int(input())
ans = 0
for i in range(1, n+1):
    if i%3==0 and i%5==0: continue
    elif i%3==0: continue
    elif i%5==0: continue
    ans+=i
print(ans)

Solution (Python):
n = int(input())
a = [i for i in range(1, n+1) if i % 3 != 0 and i % 5 != 0]
print(sum(a))

Solution (Python):
import math

def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]

n = NextInt()
ans = 0
for i in range(1, n+1):
    if i%5 != 0 and i%3 != 0:
        ans += i
print(ans)

Solution (Python):
n = int(input())
s = 0
for i in range(1, n+1):
    if i%3 > 0 and i%5 > 0:
        s += i

print(s)

Solution (Python):
n = int(input())
a = 0
for i in range(1, n+1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    a += i
print(a)

Solution (Python):

import sys


N = int(input())
ans = 0

for i in range(N+1):
    if i%3 == 0 or i%5 == 0:
        None
    else:
        ans += i

print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N+1):
    if i % 3 == 0 and i % 5 == 0:
        continue
    elif i % 3 == 0:
        continue
    elif i % 5 == 0:
        continue
    else:
        ans += i

print(ans)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    ans = 0
    for i in range(1, N + 1):
        if i % 3 != 0 and i % 5 != 0:
            ans += i
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):

''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/input.txt"
exit $?
'''
import sys


def _i(): return int(sys.stdin.readline().strip())


def main():
    n = _i()

    ans = 0
    for i in range(1, n+1):
        if i % 3 != 0 and i % 5 != 0:
            ans += i
    return ans


if __name__ == "__main__":
    print(main())

Solution (Python):



 
import sys
import math



 

fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile


mod=1000000007
 

def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 

t=1
for tt in range(t):
    n=int(input())
    c=0
    ans=0
    for i in range(n+1):
        if(i%3!=0) and (i%5 !=0):
            ans+=i
    print(ans)
    
    
    
    

if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

Solution (Python):
n = int(input())
ans =sum(i for i in range(1, n+1) if i %3 != 0 and i % 5 != 0)
print(ans)

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

Solution (Python):
N = int(input())

ans = 0
for i in range(1, N + 1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        ans += i
print(ans)

Solution (Python):
n = int(input())
ans = 0
for i in range(1,n+1):
    if i%5 == 0 or i%3 == 0:
        True
    else:
        ans += i
print(ans)

Solution (Python):
n = int(input())

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

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N + 1):        
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)

Solution (Python):

import sys
input = sys.stdin.buffer.readline


from collections import defaultdict

con = 10 ** 9 + 7

def getlist():
	return list(map(int, input().split()))


def main():
	N = int(input())
	ans = 0
	for i in range(1, N + 1):
		if i % 3 != 0 and i % 5 != 0:
			ans += i

	print(ans)
	


if __name__ == '__main__':
	main()

Solution (Python):
print(sum(i for i in range(1, int(input()) + 1) if i % 3 > 0 and i % 5 > 0))

Solution (Python):

def main():
    n = int(input())
    s = 0
    for i in range(1,n+1):
        if i%3==0:
            continue
        if i%5==0:
            continue
        s += i
    print(s)
           
            
if __name__ == "__main__":
    main()

Solution (Python):

from decimal import *
from itertools import permutations, combinations,combinations_with_replacement,product
import math


N = int(input())
ans = 0
for i in range(1,N+1):
    if(i % 3 != 0 and i % 5 != 0):
        ans += i

print(ans)

Solution (Python):
n = int(input())

ans = 0
for i in range(1, n+1):
  if i % 3 == 0 and i % 5 == 0:
    continue
  elif i % 3 == 0:
    continue
  elif i % 5 == 0:
    continue
  else:
    ans += i

print(ans)

Solution (Python):
n = int(input())

sum=0
for i in range(1,n+1):
    if i%3 != 0 and i%5!= 0:
        sum+=i

print(sum)

Solution (Python):
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


def main():
    N = int(input())

    res = 0
    for i in range(1,N+1):
        if i % 3 != 0 and i % 5 != 0:
            res += i
    
    print(res)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
ans = 0
for i in range(1, n+1):
    if i%3 != 0 and i%5 !=0:
        ans += i

print(ans)

Solution (Python):
n = int(input())

ans = 0
for i in range(1, n + 1):
    if i % 3 != 0 and i % 5 != 0:
       ans += i

print(ans)

Solution (Python):
N = int(input())
ans = 0

for i in range(1, N+1):
    if i % 3 == 0:
        continue
    elif i % 5 == 0:
        continue
    else:
        ans += i

print(ans)

Solution (Python):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') 
def gcd(a,b):return fractions.gcd(a,b) 
def lcm(a,b):return (a*b) // fractions.gcd(a,b) 
def iin(): return int(sys.stdin.readline()) 
def ifn(): return float(sys.stdin.readline()) 
def isn(): return sys.stdin.readline().split() 
def imn(): return map(int, sys.stdin.readline().split()) 
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) 
def fmn(): return map(float, sys.stdin.readline().split()) 
def iln(): return list(map(int, sys.stdin.readline().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def fln(): return list(map(float, sys.stdin.readline().split())) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) 
def comb(l, n): return itertools.combinations(l, n) 
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) 
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def No(): print('No')
 
def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N = iin()

ans = 0
for i in range(1, N+1):
    if i % 3 == 0 or i % 5 == 0: continue
    ans += i
print(ans)

Solution (Python):
import sys

N = int(sys.stdin.readline().rstrip())

ans = sum([i for i in range(1, N + 1) if i % 3 != 0 and i % 5 != 0])

print(ans)

Solution (Python):
N = int(input())

sum_ = 0
for i in range(1, N + 1):

    if i % 5 == 0 or i % 3 == 0:
        continue

    sum_ += i

print(sum_)

Solution (Python):
def main():
    N = int(input())

    answer = 0

    for i in range(1, N+1):
        if i%3==0 or i%5==0:
            continue
        answer += i

    print(answer)

if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
ans=0
for i in range(1,N+1):
    if i%3!=0 and i%5!=0:
        ans+=i
print(ans)

Solution (Python):
n = int(input())

ans = 0
for i in range(1, n + 1):
    if i % 3 and i % 5:
        ans += i

print(ans)

Solution (Python):
n = int(input().strip())
ans = 0
for i in range(1, (n + 1)):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)

Solution (Python):
N=int(input())
all=[]
for n in range(N):
    if (n+1)%3!=0 and (n+1)%5!=0:
        all.append(n+1)
print(sum(all))

Solution (Python):
N = int(input())

ans = 0
for i in range(1, N + 1):
    if i % 15 != 0 and i % 3 != 0 and i % 5 != 0:
        ans += i

print(ans)

Solution (Python):



import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    r = sum(i for i in range(1, N+1) if i % 3 and i % 5)
    print(r)
    return
main()

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N + 1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)

Solution (Python):
N = int(input())
ans = 0

for i in range(1,N+1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)

Solution (Python):
n = int(input())
ans = 0

for i in range(1, n+1):
    if not(i % 3 == 0 or i % 5 == 0):
        ans += i
print(ans)

Solution (Python):
n = int(input())
ans = 0
for i in range(1,n+1):
    if i % 3 > 0 and i % 5 > 0:
        ans += i
print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N + 1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)

Solution (Python):
n = int(input())
print(sum(range(n + 1)) - 3 * sum(range(n // 3 + 1)) - 5 * sum(range(n // 5 + 1)) + 15 * sum(range(n // 15 + 1)))

Solution (Python):
import sys
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
ans = 0

for i in range(1,n+1):
    if i%3!=0 and i%5!=0:
        ans+=i

print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1,N+1):
  if i%3==0:
    continue
  if i%5==0:
    continue
    
  ans+=i
  
print(ans)

Solution (Python):
def resolve():
    n = int(input())
    s = 0
    for i in range(1, n+1):
        if (i % 3) != 0 and (i % 5) != 0:
            s += i

    print(s)


resolve()

Solution (Python):
N = int(input())
ans = 0
for i in range(1,N+1):
    if i%3==0 or i%5==0:
        continue
    else:
        ans += i
    
print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N+1):
    if i % 3 == 0:
        continue
    if i % 5 == 0:
        continue
    ans += i
print(ans)

Solution (Python):
n = int(input())

total = 0
for i in range(n + 1):
    if i % 3 != 0 and i % 5 != 0:
        total += i

print(total)

Solution (Python):
N = int(input())

s = 0

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

Solution (Python):
import sys








sys.setrecursionlimit(10**6)
readline = sys.stdin.readline


def main():
    
    N = int(input())
    ans = 0
    for i in range(1, N+1):
        if i%3 != 0 and i%5 != 0:
            ans += i

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    N=int(input())
    cnt=0
    for i in range(1,N+1):
        th=i%3
        fiv=i%5
        if th!=0 and fiv!=0:
            cnt+=i
    print(cnt)




resolve()

Solution (Python):
num = int(input())
ans = sum([i for i in range(1, num + 1) if i % 3 > 0 and i % 5 > 0])
print(ans)

Solution (Python):
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


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


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    ret = 0
    for n in range(1, N + 1):
        if not fb(n):
            ret += n
    print(ret)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
sum = 0
for i in range(1, n+1):
    if i % 3 == 0:
        continue
    elif i % 5 == 0:
        continue
    else:
        sum += i

print(sum)

Solution (Python):
N = int(input())

total = 0
for i in range(N + 1):
	if i % 3 == 0 and i % 5 == 0:
		pass
	elif i % 3 == 0:
		pass
	elif i % 5 == 0:
		pass
	else:
		total += i
print(total)

Solution (Python):
N = int(input())
wa = 0
for i in range(N+1):
    if i % 3 !=0 and i % 5 != 0:
        wa += i
        
print(wa)

Solution (Python):
n = int(input())
ans = 0
for i in range(1,n+1):
    if(i%3 != 0 and i%5!=0 and i%15!=0):
        ans += i
print(ans)

Solution (Python):


N=int(input())
ans=0

for i in range(1,N+1):
    if i%3==0 or i%5==0:
        continue
    else:
        ans+=i

print(ans)

Solution (Python):
N = int(input())

ans = 0
for i in range(1, N+1):
    if i % 3 != 0 and i % 5 != 0:
        ans +=  i
    
print(ans)

Solution (Python):
N = int(input())
sum = 0
for i in range(1, N+1):
    if i % 3 != 0 and i % 5 != 0:
        sum += i

print(sum)

Solution (Python):


def main():
     n = int(input())
     ans = 0

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

if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
ans = 0

for i in range(1, N+1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1,N+1):
    if i%3 == 0 and i%5 == 0:
        continue
    elif i%3 == 0:
        continue
    elif i%5 == 0:
        continue
    else:
        ans += i
print(ans)

Solution (Python):
N = int(input())

ans = 0
for i in range(1, N + 1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)

Solution (Python):
n = int(input())
ans = 0
for i in range(n+1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        ans += i
print(ans)

Solution (Python):

N = int(input())
ans = 0
for i in range(1, N+1):
    if i % 15 == 0:
        pass
    elif i % 5 == 0:
        pass
    elif i % 3 == 0:
        pass
    else:
        ans += i
print(ans)

Solution (Python):
import math
import fractions
import sys
input = sys.stdin.readline

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans
'''
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 2
N = 10 ** 6 + 2
fact = [1, 1]  
factinv = [1, 1]  
inv = [0, 1]  

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

'''









n = int(input())

ans = 0
for ii in range(n):
    i = ii+1
    if(not(i%3==0 or i%5==0)):
        ans += i

print(ans)

Solution (Python):
import math

n = int(input())

c = 0
for i in range(1, n + 1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        c += i

print(c)

Solution (Python):

import sys


def solve(N: int):
    count = 0
    for i in range(1, N+1):
        if not (i % 3 == 0 or i % 5 == 0):
            count += i
    print(count)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    solve(N)

if __name__ == '__main__':
    main()

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

Solution (Python):
N = int(input())

ans = 0
for i in range(1, N + 1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i

print(ans)

Solution (Python):
n = int(input())
ans = 0
for i in range(1, n+1):
    if i%15==0 or i%3 == 0 or i%5 ==0:
        continue
    else:
        ans += i
print(ans)

Solution (Python):
N = int(input())

count = 0

for i in range(N + 1):
    if i % 3 != 0 and i % 5 != 0:
        count += i

print(count)

Solution (Python):
ans = 0
for i in range(1, int(input()) + 1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i

print(ans)

Solution (Python):
N = int(input())
s = 0
for i in range(1, N+1):
    if i % 15 == 0 or i % 3 == 0 or i % 5 == 0:
        continue
    s += i
print(s)

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N+1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)

Solution (Python):
n = int(input())
s = 0
for i in range(1,n+1):
	if i%3 == 0 or i%5==0:
		pass
	else:
		s += i 
print(s)

Solution (Python):
N=int(input())
ans=0
for i in range(1,N+1):
    if i%3==0 or i%5==0:
        continue
    ans+=i
print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N + 1):
    if not (i % 5 == 0 or i % 3 == 0):
        ans += i
print(ans)

Solution (Python):
N = int(input())
ans = sum(i for i in range(N + 1) if i % 3 != 0 and i % 5 != 0)
print(ans)

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

Solution (Python):
N = int(input())

ans = 0

for i in range(1, N + 1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i

print(ans)

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    sum=0
    for i in range(1,n+1):
        if i%3!=0 and i%5!=0:sum+=i

    print(sum)
if __name__=='__main__':
    main()

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
res = 0
for i in range(N + 1):
  if i % 3 == 0 or (i % 5 == 0): continue
  res += i
print(res)

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

Solution (Python):
N = int(input())
res = 0
for i in range(1, N + 1):
    if i % 3 == 0 and i % 5 == 0:
        continue
    elif i % 3 == 0:
        continue
    elif i % 5 == 0:
        continue
    else:
        res += i
print(res)

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N+1):
  if i % 5 != 0 and i % 3 != 0:
    ans += i
print(ans)

Solution (Python):
n = int(input())

ans = 0
for i in range(1, n + 1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    ans += i
print(ans)

Solution (Python):
N = int(input())
ans = 0


for i in range(N+1):
    if  i % 3 != 0:
        if  i % 5 != 0:
            ans += i
print(ans)

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

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

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    N = int(input())

    ans = 0
    for i in range(1, N + 1):
        if (i % 3 != 0) and (i % 5 != 0):
            ans += i
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
N=int(input())

ans=0
for i in range(1,N+1):
    if i%15==0 or i%3==0 or i%5==0:
        continue
    else:
        ans+=i
print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1,N+1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)

Solution (Python):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

N = i_i()

ans = 0
for i in range(1, N+1):
    if i % 15 == 0:
        ans = ans
    elif i % 5 == 0:
        ans = ans
    elif i % 3 == 0:
        ans = ans
    else:
        ans += i

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

N = int(input())

ans = 0
for i in range(1, N + 1):
    if i % 3 and i % 5:
        ans += i

print(ans)

Solution (Python):
def main():
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        if i % 3 != 0 and i % 5 != 0:
            ans += i
    print(ans)
if __name__=='__main__':
    main()

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

Solution (Python):
N = int(input())
ans = 0
for i in range(1,N+1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)

Solution (Python):
n = int(input())

a = 0

for i in range(n):
  i+=1
  if i%3 == 0 or i%5== 0:
    continue
  else:
    a += i

print(a)

Solution (Python):
n = int(input())


num = 0

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

Solution (Python):
n = int(input())

ans = 0
for i in range(1, n + 1):
    if i % 15 == 0:
        continue
    elif i % 5 == 0:
        continue
    elif i % 3 == 0:
        continue
    else:
        ans += i

print(ans)

Solution (Python):
n = int(input())
res = 0
for i in range(1, n+1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        res += i
print(res)

Solution (Python):
N = int(input())
ans = 0
for i in range(1,N+1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()

N = int(input())

ans = 0
for i in range(1, N+1):
    if i % 3 == 0:
        continue
    if i % 5 == 0:
        continue
    
    ans += i

print(ans)

Solution (Python):
n = int(input())




count = 0
for i in range(1,n+1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    else: 
        count+= i
print(count)

Solution (Python):
n = int(input())

ans = 0

for i in range(1,n+1):
  if i%3>0 and i%5>0:
    ans += i

print(ans)

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

Solution (Python):
def main():
    ans = 0
    n = int(input())
    for i in range(1, n+1):
        if i%3 != 0 and i%5 != 0:
            ans += i
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
total = 0
for i in range(1,n+1):
	if i % 3 != 0 and i % 5 != 0:
		total += i

print(total)

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

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N+1):
  if i % 3 == 0 and i % 5 == 0:
    pass
  elif i % 3 == 0:
    pass
  elif i % 5 == 0:
    pass
  else:
    ans += i
print(ans)

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

Solution (Python):
def main():
    N = int(input())
    ans = 0
    for i in range(1,N+1):
        if i%3 != 0 and i%5 != 0:
            ans += i

    print(ans)

main()

Solution (Python):
n = int(input())
ans = 0
for i in range(n+1):
    if not (i%3==0 or i%5==0):
        ans += i

print(ans)

Solution (Python):
n = int(input())

ans = 0
for i in range(1, n+1):
    if i % 3 == 0:
        pass
    elif i % 5 == 0:
        pass
    else:
        ans += i

print(ans)

Solution (Python):
n = int(input())


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

print(s)

Solution (Python):
N = int(input())
res = 0

for i in range(1, N+1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    res += i

print(res)

Solution (Python):
n = int(input())

ans = 0
for i in range(1, n+1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i

print(ans)

Solution (Python):
n=int(input())

count = 0
for i in range(1,n+1):
    if not(i%3==0 or i%5==0):
        count += i
        
print(count)

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N+1):
    if i%15==0:
        pass
    elif i%3==0 or i%5==0:
        pass
    else:
        ans += i

print(ans)

Solution (Python):



def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def check(s):
    for i in range(len(s)):
        if s[i] != s[len(s)-1-i]:
            return False
    return True

def main():
    ans = 0
    n = ri()
    for i in range(1,n+1):
        if i%3 == 0 or i%5 == 0:
            continue
        ans += i
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):

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

Solution (Python):
n = int(input())
res = 0
for i in range(1, n+1):
  if i % 3 == 0 or i % 5==0:
    continue
  else:
    res += i
print(res)

Solution (Python):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    ans=0
    for i in range(1,N+1):
        if i%3!=0 and i%5!=0:
            ans+=i
            
    print(ans)

main()

Solution (Python):
N = int(input())

sum_ = 0
for i in range(1, N+1):
  if i % 3 == 0:
    pass
  elif i % 5 == 0:
    pass
  else:
    sum_ += i
print(sum_)

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

Solution (Python):
N = int(input())

sm = 0
for i in range(1, N+1):
    if i % 3 > 0 and i % 5 > 0:
        sm += i

print(sm)

Solution (Python):
def main():
    n = int(input())
    ans = 0
    for i in range(1, n + 1):
        if i % 3 > 0 and i % 5 > 0:
            ans += i
    print(ans)


if __name__ == '__main__':
    main()