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())
def fizzbuzz_sum(n):
    result = 0
    for i in range(1, n+1):
        if i % 5 == 0 or i % 3 == 0:
            result += 0
        else:
            result += i
    return result



result = fizzbuzz_sum(n)
print("{}".format(result))

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

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

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 % 3 == 0 or i % 5 == 0: continue
    ans += i
print(ans)

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

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

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
from sys import stdin

def A():
    n = stdin.readline().rstrip()
    flag = bool()

    for st in n:
        if st == '7':
            flag = True

    if flag:
        print("Yes")
    else:
        print("No")  


def B():
    n = stdin.readline().rstrip()
    sum = 0

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

    print(sum)


def main():
    B()

if __name__ == "__main__":
    main()

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

lists = []
lists_NG = []
for i in range(1, N+1):
    if i % 3 == 0 or i % 5 == 0:
        lists_NG.append(i)
    else:
        lists.append(i)

print(sum(lists))

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 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())
tot = 0
for i in range(1, n + 1):
    if not ((i % 5 == 0) | (i % 3 == 0)):
        tot += i
print(tot)

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

ret = sum(list(range(1,n+1)))
sub3 = sum(list(range(3,n+1,3)))
sub5 = sum(list(range(5,n+1,5)))
sub15 = sum(list(range(15,n+1,15)))
ret = ret - sub3 - sub5 + sub15
print(ret)

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):
print(sum([i for i in range(1,int(input())+1) if int(i)%3!=0 and int(i)%5!=0 ]))

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

Solution (Python):
n = int(input())
nums = []
for num in range(1, n+1):
    if num % 3 != 0 and num % 5 != 0:
        nums.append(num)

print(sum(nums))

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

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):
def total(n):
    return n * (n + 1) // 2

n = int(input())
n3 = n // 3
n5 = n // 5
n15 = n // 15

print(total(n) - total(n3) * 3 - total(n5) * 5 + total(n15) * 15)

Solution (Python):
N=int(input())
ans=0
for i in range(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 x in range(1,N+1):
    if not(x%3==0 or x%5==0):
        ans+=x
print(ans)

Solution (Python):
N = int(input())
a = N // 3
b = N // 5
c = N // 15
ans = N*(N+1)/2-3*a*(a+1)/2-5*b*(b+1)/2+15*c*(c+1)/2
print(int(ans))

Solution (Python):
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


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


def ZIP(n): return zip(*(MAP() for _ in range(n)))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    n = INT()
    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())
a = 0

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

print(a)

Solution (Python):

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

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 = []

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

print(sum(a))

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

def fizz_buzz(n):
  return 0 if n % 5 == 0 or n % 3 == 0 else n

print(sum(
  fizz_buzz(i)
  for i in range(1, N + 1)
))

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

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())

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

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

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


print(count)

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

s = N * (N+1) //2

M = N // 3
s3 = 3 * M * (M+1) // 2

M = N // 5
s5 = 5 * M * (M+1) // 2

M = N // 15
s15 = 15 * M * (M+1) // 2

print(s - s3 - s5 + s15)

Solution (Python):
if __name__ == '__main__':
    N = int(input())
    arr = list(range(1, N+1))
    arr = list(filter(lambda elem: not (elem%3 == 0 or elem%5 == 0), arr))
    print(sum(arr))

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

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

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

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())
fizz = 3 * sum([i + 1 for i in range(n // 3)])
buzz = 5 * sum([i + 1 for i in range(n // 5)])
fizzbuzz = 15 * sum([i + 1 for i in range(n // 15)])
ans = sum([i + 1 for i in range(n)]) - fizz - buzz + fizzbuzz
print(ans)

Solution (Python):
N=int(input())
X=N*(1+N)//2
a=N//3
S3=a*(3+3*a)//2
b=N//5
S5=b*(5+5*b)//2
c=N//15
S15=c*(15+15*c)//2
print(X-S3-S5+S15)

Solution (Python):
n = int(input())
ans = []
for i in range(1,n+1):
    if i%15==0:
        continue
    else:
        if i%3==0:
            continue
        elif i%5==0:
            continue
        else:
            ans.append(i)
print(sum(ans))

Solution (Python):
n = int(input())
three = n//3
five = n//5
fifteen = n//15
print(n*(n+1)//2 - 3*three*(three+1)//2 - 5*five*(five+1)//2 + 15*fifteen*(fifteen+1)//2)

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())+1
count=0
for i in range(n):
  if i%3!=0 and i%5!=0:
    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())
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())

total = 0

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

print(total)

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

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

res = []

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

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

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

print(sum_N)

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

result = sum(range(1,N+1))


N_3 = math.floor(N/3)
result_3 = sum(range(1, N_3+1))*3

N_5 = math.floor(N/5)
result_5 = sum(range(1, N_5+1))*5

N_15 = math.floor(N/15)
result_15 = sum(range(1, N_15+1))*15






print(result - result_3 -result_5 + result_15)

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


def fizzbuzz(n):
    if n % 5 == 0 and n % 3 == 0:
        return 0
    elif n % 3 == 0:
        return 0
    elif n % 5 == 0:
        return 0
    else:
        return n


def main():
    n = int(input())
    li = list(range(1, n+1))

    change_li = list(map(fizzbuzz, li))

    print(sum(change_li))


if __name__ == '__main__':
    main()

Solution (Python):
def main():

    N = int(input())

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

    print(sum)

if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
fizz_buzz_sum = 0
for i in range(N):

    if ((i+1)%3 != 0) and  ((i+1)%5 != 0):
        fizz_buzz_sum += i+1
print(fizz_buzz_sum)

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

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

l = []

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

Solution (Python):
N = int(input())
N3 = N // 3
N3 = 0.5 * N3 * (2 * 3 + (N3 - 1) * 3)
N5 = N // 5
N5 = 0.5 * N5 * (2 * 5 + (N5 - 1) * 5)
N15 = N // 15
N15 = 0.5 * N15 * (2 * 15 + (N15 - 1) * 15)

print(int(N*(N+1) // 2 - (N3 + N5 - N15)))

Solution (Python):
N = int(input())
FB = [i for i in range(1,N+1)]
f = [i for i in range(3,N+1,3)]
b = [i for i in range(5,N+1,5)]
fb = [i for i in range(15,N+1,15)]
l = sum(FB)
m = sum(f)
n = sum(b)
o = sum(fb)
print(l-m-n+o)

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())
ans=0

for i in range(n):
    if ((i+1)%3!=0 and (i+1)%5!=0):
        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):
N = int(input())
summation = 0
for i in range(1, N + 1):
    if i % 3 != 0 and i % 5 != 0:
        summation += i
print(summation)

Solution (Python):
def main():
    N = int(input())
    value_temp = 0
    value = 0
    for i in range(1 , N+1) :
        if i % 3 == 0 or i % 5 == 0 :
            pass
        else :
            value_temp = i
            value = value + value_temp
    print (value)

if __name__ == '__main__':
    main()

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 = (n*(n+1))//2
mod3 = (((n//3) * ((n//3) + 1))//2 ) * 3
mod5 = (((n//5) * ((n//5) + 1))//2 ) * 5
mod15 = (((n//15) * ((n//15) + 1))//2 ) * 15
print(ans - mod3 - mod5 + mod15)

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())
a=[i for i in range(n+1) if (i%3!=0)and(i%5!=0)and(i%15!=0)]
print(sum(a))

Solution (Python):
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    N = ir()
    ans = 0
    for i in range(1, N+1):
        if i%3 != 0 and i%5 != 0:
            ans += i
    print(ans)
resolve()

Solution (Python):
n = int(input())
s = 0
while n > 0:
    if not (n % 3 == 0 or n % 5 == 0):
        s += n
    n -= 1
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):
import sys
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())
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())
a = (N - (N % 3) + 3) * (N // 3) // 2
b = (N - (N % 5) + 5) * (N // 5) // 2
c = (N - (N % 15) + 15) * (N // 15) // 2
d = (1 + N) * N // 2
print(d - a - b + c)

Solution (Python):
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

N = INT()

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):

import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

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())

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

Solution (Python):

input_d21 = input()
N = int(input_d21)
wa = 0
for i in range(1,N+1):
    test3 = i % 3
    test5 = i % 5
    if test3 != 0 and test5 != 0:
        wa += i
    else:
        pass
print(wa)

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
from io import StringIO
import unittest

def resolve():
    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(str(ans))

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """15"""
        output = """60"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """1000000"""
        output = """266666333332"""
        self.assertIO(input, output)

if __name__ == "__main__":
    
    resolve()

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())
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())
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(''))
s=0
for a in range(n):
    if (a+1)%5!=0 and (a+1)%3!=0 and (a+1)%15!=0:
        s=s+a+1

print(s)

Solution (Python):
import sys
from math import factorial
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

N = INT()
count15 = N//15
count3 = N//3
count5 = N//5
sum3 = count3*(count3+1)*3//2
sum5 = count5*(count5+1)*5//2
sum15 = count15*(count15+1)*15//2
temp = sum3+sum5-sum15
print(N*(N+1)//2 -temp)

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

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

def s(n):
  return (n*(n+1))//2
  

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

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

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

print(count)

Solution (Python):

from sys import stdin
from operator import itemgetter
from collections import deque
import math
import pprint


def keta(kazu):
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

N = int(stdin.readline().rstrip())
now = 1
ans = 0

while now <= N:
    if now%3 != 0 and now%5 != 0 and now%15 != 0:
        ans += now
    now += 1

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())
sum=0
for i in range(1, N+1):
    if i%3!=0 and i%5!=0:
        sum+=i

print(sum)

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

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


print(sum)

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

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

Solution (Python):
from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin


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


def input(): return stdin.readline().rstrip()


main()

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

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

print(s)

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

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

print(ans)

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

sums = 0

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

print(sums)

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

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

print(sum)

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

Solution (Python):
import sys

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())

c = 0

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

print(c)

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

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:
        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())
x=0
for i in range(1,N+1):
    if (i%3==0) and (i%5==0):
        x +=0
    elif i%3==0:
        x+=0
    elif i%5==0:
        x+=0
    else:
        x+=i
print(x)

Solution (Python):



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

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

    print(total)


if __name__ == '__main__':
    main()

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):
s=int(input())
a=s//3
b=s//5
c=s//15
d=s*(s+1)
d=d//2
a=a*(a+1)*3
a=a//2
b=b*(b+1)*5
b=b//2
c=c*(c+1)*15
c=c//2
e=d-a-b+c
print(e)

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

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())
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())
result = 0
for num in range(1, n+1):
    if num % 3 != 0 and num % 5 != 0:
        result += num

print(result)

Solution (Python):
n = int(input())
fizzlist = []
for i in range(1,n+1):
    if i%3 == 0 or i%5 ==0:
        pass
    else:
        fizzlist.append(i)
print(sum(fizzlist))

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())

r = 0

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

print(r)

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

print(sum)

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

sum = 0

for Ai in range(1, N + 1, 1):
  if Ai % 3 == 0 and Ai % 5 == 0:
    
    pass
  elif Ai % 3 == 0:
    pass
    
  elif Ai % 5 == 0:
    pass
      
  else:
    sum += Ai

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())

sum = 0

for i in range(n+1):
    if i%3 == 0 or i%5==0:
        pass
    else:
        sum += i
print(sum)

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

ans = []
for i in range(1,N+1):
    if i % 3 == 0:
        continue 
    elif i % 5 == 0:
        continue
    ans.append(i)
print(sum(ans))

Solution (Python):
import numpy as np

def main():
    
    k = int(input())
    j = 0
    sum = []
    for i in range(k):
        num = i+1
        if num % 15 == 0:
            pass
        elif num % 3 == 0:
            pass
        elif num % 5 == 0:
            pass
        else:
            sum.append(num)
    print(np.sum(np.array(sum)))

if __name__ == '__main__':
    main()

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

Solution (Python):

n = int(input())
num = []
for i in range(1, n+1):
    if i % 3 == 0 or i % 5 == 0:
        num.append(0)
    else:
        num.append(i)


print(sum(num))

Solution (Python):
n = int(input())
list = []
ans = 0
i = 1
while i <= n:
    if i % 15 == 0:
        list.append(i)
    elif i % 5 == 0:
        list.append(i)
    elif i % 3 ==0:
        list.append(i)
    else:
        ans += i
    i += 1
print(ans)

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

for i in range(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):

from sys import stdin
import sys
sys.setrecursionlimit(10**8)

def nextLine(): return next(stdin)
def nextStrList(): return nextLine().split()
def nextIntList(): return [int(_) for _ in nextStrList()]


def main():
	n=int(nextLine())
	n3=n//3
	s3=n3*(n3+1)//2*3
	n5=n//5
	s5=n5*(n5+1)//2*5
	n15=n//15
	s15=n15*(n15+1)//2*15
	s=n*(n+1)//2




	print(s-(s3+s5-s15))
	
	
if __name__=="__main__":
	main()

Solution (Python):




if(__name__ == '__main__'):
    
    n = int(input())

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

    print(sum)

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())

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())
print(sum(filter(lambda x: x%3 != 0 and x%5 != 0, range(n+1))))

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

for i in range(1, n + 1):
    if i%3 != 0:
        if 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 and i%5>0:
        s += i
print(s)

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())

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

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

Solution (Python):
def main():
    tmp=0
    N=int(input())
    for i in range(1,N+1):
        if i%3==0 or i%5==0:
            tmp+=i
    print(sum([i for i in range(N+1)])-tmp)

main()

Solution (Python):
N = int(input())
sum = 0
for i in range(1, N+1):
    if divmod(i, 3)[1] == 0 or divmod(i, 5)[1] == 0:
        pass
    else:
        sum += i

print(sum)

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):
n = int(input())
s=0
for i in range(1,n+1):
    if(i%5==0 and i%3==0):
        continue
    elif(i%3==0):
        continue
    elif(i%5==0):
        continue
    else:
        s+=i
print(s)

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):
n = int(input())

ans = 0
i = 1
while i <= n:
  if i % 3 == 0 or i % 5 == 0:
    i += 1
    continue
  ans += i
  i += 1

print(ans)

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

ans = 0

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

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

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

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

result = 0

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

print(result)

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):
num = int(input())
count = 0
for i in range(num):
    if (i + 1) % 15 == 0:
        pass
    elif (i + 1) % 3 == 0:
        pass
    elif (i + 1) % 5 == 0:
        pass
    else:
        count += i + 1
print(count)

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

print(s)

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

print(ans)

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

total = 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:
        total += i

print(total)

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

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

print(answer)

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

    tmp = [i for i in range(1, N+1)if not (i % 3 == 0 or i % 5 == 0)]
    print(sum(tmp))


if __name__ == '__main__':
    main()

Solution (Python):
from collections import defaultdict
import math

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

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

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


print(sum_ans)