peterverebics/CodeNet_Python_118 huggingface dataset:
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

ans = 0
N = Int()

for i in range(1,N+1):
    if i%3!=0 and i%5!=0:
        ans += i
print(ans)
N = int(input())
N1 = N + 1
N2 = N1 * N
S0 = N2 / 2
# print(int(S0))

Na = N//3
N1a = Na + 1
N2a = N1a * Na
S0a = 3 * N2a / 2
# print(int(S0a))

Nb = N//5
N1b = Nb + 1
N2b = N1b * Nb
S0b = 5 * N2b / 2
# print(int(S0b))

Nc = N//15
N1c = Nc + 1
N2c = N1c * Nc
S0c = 15 * N2c / 2
# print(int(S0c))

S = S0 - S0a - S0b + S0c

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

count = 0
for i in range(1, n+1):
  if i % 3 != 0 and i % 5 != 0:
    count += i
print(count)
N = int(input())
num = [1]*(N+1)
num[0] = 0
for a in range(3,len(num),3):
    num[a] = 0
for b in range(5,len(num),5):
    num[b] = 0
t = 0
for a in range(len(num)):
    if num[a] == 1:
        t += a
print(t)
a = int(input())
total = 0
for i in range(1, a+1):
  if i % 5 != 0 and i % 3 != 0:
    total += i

print(total)
def main():
    n = int(input())
    total = 0
    for i in range(1,n+1):
        if i % 3 == 0 and i % 5 == 0:
            pass
            #print("FizzBuzz")
        elif i%3 == 0:
            pass
            #print("Fizz")
        elif i%5 == 0:
            pass
            #print()
        else:
            total += i
    print(total)



if __name__ == '__main__':
    main()
n = int(input())
s = (1+n) * n // 2
for i in range(1, n+1):
    if i % 3 == 0 or i % 5 == 0:
        s -= i
print(s)
n = int(input())

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

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

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

ans = 0

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

print(ans)
N = int(input())

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

print(sum(box))
a=int(input())
b=[]
for i in range(a+1):
    if i%3==0 or i%5==0:
        continue
    else:
        b.append(i)
print(sum(b))
n = int(input())
ans = 0
for i in range(1, n+1):
  if (i%3 != 0) and (i%5 != 0):
    ans += i
print(ans)
n=int(input())
ans=0
for i in range(1,n+1):
    if i%3!=0 and i%5!=0:
      ans+=i
print(ans)
N = int(input())
sum = 0

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

print(str(sum))
n = int(input())
m = 0
a = n // 3
b = n // 5
c = n // 15
for i in range(1,n+1):
    m = m+i
for j in range(1,a+1):
    m = m-(3*j)
for k in range(1,b+1):
    m = m-(5*k)
for l in range(1,c+1):
    m = m+(15*l)
print(m)
N = int(input())

SUM = 0

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

print(SUM)
N = int(input())

i = 1
li = []
for j in range(N):
    if ((i % 3) == 0) or ((i % 5) == 0):
        i = i + 1
    else:
        li.append(i)
        i = i + 1
        
print(sum(li))
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)
N = int(input())
A=0
for i in range(1,N+1):
    if not ((i%3==0 and i%5==0) or i%3==0 or i%5==0):
      A=A+i
print(A)
a=0
n=int(input())
for i in range(n+1):
    if i%3!=0 and i%5!=0:
        a += i
print(a)
N = int(input())

ans = 0
for n in range(1, N+1):
    if n%3 != 0 and n%5 != 0:
        ans += n
print(ans)
# 整数を一つ入力
N = int(input())

res = 0

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

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

a = 0

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

print(a)
N=1
a=int(input())
ans=0
while N<=a :
  if N%3==0 and N%5==0 :
    pass
  elif N%3==0 :
    pass
  elif N%5==0 :
    pass
  else :
    ans+=N
  N+=1
print(ans)
N = int(input())

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

# initialization
ans = 0

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

# output
print(ans)
n = int(input())
a = n // 3
b = n // 5
c = n // 15
print(n * (n + 1) // 2 - a * (a + 1) // 2 * 3 - b * (b + 1) // 2 * 5 + c * (c + 1) // 2 * 15)
import sys
N=int(sys.stdin.readline()[:-1])
ans=0
for i in range(1,N+1):
    if i%3==0 or i%5==0:
        pass
    else:
        ans+=i
print(ans)
N=int(input())
N3=N//3
N5=N//5
N15=N//15
def s(x):
  return x*(x+1)//2
print(s(N)-3*s(N3)-5*s(N5)+15*s(N15))
N = int(input())
print(sum(map(lambda x:x if (x % 3 != 0) and (x % 5 != 0) else 0,list(range(N + 1)))))
#変数の初期化
text = 0
count = 0

#入力値の格納
n = int(input())

#計算
while count < n:
    count += 1
    if (count % 3 != 0) and (count % 5 != 0):
        text = text + count

#表示
print(text)
a = int(input())
lis = []
for i in range(1, a+1):
    lis.append(i)
for j in range(len(lis)):
    b = lis[j]
    if b % 3 ==0:
        lis[j] = 0
    if b % 5 ==0:
        lis[j] = 0
print(sum(lis))
#! /usr/bin/env python
# -*- coding: utf-8 -*-

def main():
	num = int(input())
	sum = 0
	for i in range(num):
		if not (i+1) % 3 == 0 and not (i+1) % 5 == 0:
			sum += (i+1)
	
	print (sum)

if __name__ == '__main__':
	main()
n = int(input())
ans = 0

for i in range(1,n+1):
  if i%3 == 0:
    continue
  
  if i%5 == 0:
    continue
    
  ans = ans + i
  
print(ans)
def could_divide(num):
  return (num%3==0 or num%5==0)
n=int(input())
answer=0
for i in range(1,n+1):
  if(not could_divide(i)):
    answer+=i
print(answer)
n = int(input())
sum = 0
for i in range(n+1):
    if not (i % 3 == 0 or i % 5 ==0):
        sum += i
print(sum)
n=int(input())
a=n//3*(n//3+1)//2
threesum=a*3
b=n//5*(n//5+1)//2
fivesum=b*5
c=n//15*(n//15+1)//2
fifteensum=c*15
left=threesum+fivesum-fifteensum
sum=n*(n+1)//2
print(sum-left)
N = int(input())
a = 0

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

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

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

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

N3 = N // 3
N5 = N // 5
N15 = N // 15

s3 = int(N3*(N3+1)/2*3)
s5 = int(N5*(N5+1)/2*5)
s15 = int(N15*(N15+1)/2*15)

print(int(s-s3-s5+s15))
N=int(input())
m=[0]*N
for i in range(N):
    if (i+1)%3!=0 and (i+1)%5!=0:
        m[i]=i+1
print(sum(m))
N = int(input())
ans = 0
for i in range(N+1):
    if i%3 != 0 and i%5 != 0:
        ans += i
print(ans)
n = int(input())
ans = 0
for i in range(1,n+1):
    if i%3 != 0 and i%5 != 0:
        ans += i
print(ans)
N = int(input())

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

print(result)
n = int(input())

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

print (ans)
#!/usr/bin/env python3

N = int(input().split()[0])
total = 0

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

ans = total
print(ans)
n = int(input())
i=1
s=0
while i<=n:
    if i%3==0:
        i+=1
        continue
    elif i%5==0:
        i+=1
        continue
    else:
        s+=i
        i+=1
print(s)
#ABC162b
n = int(input())
t = [0]*(n+1)

for i in range(n+1):
    if i%15 == 0 or i%5 == 0 or i%3 == 0:
        t[i] = 0
    else:
        t[i] = i
print(sum(t))
n=int(input())
ans=0
for i in range(n+1):
    if i%3!=0 and i%5!=0:
        ans+=i
print(ans)
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)
#!/usr/bin/python3.6
a = []
i = 1
N = int(input())

while len(a) < N:
    if (i%3) == 0 or (i%5) == 0:
        a.append(0)
    else:
        a.append(i)
    i += 1

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

a = 0

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

i = 1
ans = []

for i in range(N+1):
    if i%3 == 0 and i%5 == 0:
        i = 'FizzBuzz'
    elif i%3 == 0:
        i = 'Fizz'
    elif i%5== 0:
        i = 'Buzz'
    else:
        ans.append(i)

print(sum(ans))
def main():
    n = int(input())
    print(sum([i for i in range(1, n+1) if i%3 and i%5]))

if __name__ == "__main__":
    main()
n = int(input())
result = 0;
for i in range(n):
    if (i + 1) % 3 != 0 and (i + 1) % 5 != 0:
        result += (i + 1)
print(result)
import sys
input = sys.stdin.readline

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

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

print(L)
N = input()
a = list()
for i in range(1,int(N)+1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        a.append(i)
print(sum(a))
N = int(input())
s = 0
for i in range(1, N + 1):
    if i % 3 and i % 5: s += i
print(s)
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)
N = int(input())
s = 0
for i in range(1, N +1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    s += i
print(s)
N = int(input())
l = [i for i in range(N+1)  if not i % 3 == 0 and not i % 5 == 0]
print(sum(l))
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)
n=int(input())
ans = 0
ans += n*(n+1)//2
ans += 15*(n//15)*(n//15+1)//2
ans -= 3*(n//3)*(n//3+1)//2
ans -= 5*(n//5)*(n//5+1)//2
print(ans)
N = int(input())
A = [0]*(N)

def solution(N,A):
    for i in range(1,N+1):
        A[i-1] = i
    
        if A[i-1]%3==0 or A[i-1]%5==0:
            A[i-1] =0
    print(sum(A))

solution(N,A)
import sys
N = int(input())
r3 = N//3
r5 = N//5
r15 = N//15
def sum(N):
    return int(1/2*N*(N+1))
S = sum(N) - 3*sum(r3) - 5*sum(r5) +15*sum(r15)
print(S)
N = int(input())

sum = 0

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

print(sum)
# coding: utf-8
# Your code here!
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)
S = int(input())
result = 0
for i in range(1,S+1):
    if i %3 != 0 and i %5 != 0 :
        result += i
print(result)
n = int(input())
res = 0
for i in range(1,n+1):
    if i%3!=0 and i%5!=0:
        res += i
print(res)
x = int(input())
print(sum(i for i in range(1,x+1) if ((i % 3 != 0 )) and ( i % 5 != 0 )))
N = int(input())

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

for i in range(1, n + 1):
    if i % 5 == 0 and i % 3 == 0:
        l.append('FizzBuzz')
    elif i % 3 == 0:
        l.append('Fizz')
    elif i % 5 == 0:
        l.append('Buzz')
    else:
        l.append(i)

l_filter = [l[i] for i in range(len(l)) if type(l[i]) == int]
print(sum(l_filter))
N = int(input())

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

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

def main():
    ans = sum([x for x in range(1, n + 1) if x % 3 and x % 5])
    print(ans)

if __name__ ==  '__main__':
    main()
#!usr/bin/env python3
import sys
import math
import string
import collections
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
import bisect

MOD = 10 ** 9 + 7
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

sys.setrecursionlimit(10 ** 8)

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

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

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

s=0
for i in range(1, n+1):
  if i%3!=0 and i%5!=0:
    s+=i
    
print(s)
# AtCoder
N = int(input())
sm = 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:
        sm += i
print(sm)
n=int(input())
a=n//15
b=n%15
c=0
for i in range(a*15,n+1):
  if (i%3!=0 and i%5!=0):
    c=c+i
c=c+(60+120*(a-1)+60)*a/2
print(int(c))
#b
import sys
N=input()
N=int(N)
a=int(N/3)
b=int(N/5)
c=int(N/15)
S=N*(N+1)/2 - 3*a*(a+1)/2 - 5*b*(b+1)/2 + 15*c*(c+1)/2
print(int(S))
def main():
        N = int(input())

        record = []

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

        print(sum(record))


if __name__=="__main__":
        main()
N = int(input())
tmp=0
for i in range(1, N+1):
    if (i%3!=0) and (i%5!=0):
        tmp+=i
print(tmp)
n = int(input())

import math

multiple_3 = n//3
multiple_5 = n//5
multiple_15 = n//15

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


print(plus(n)-3*plus(multiple_3)-5*plus(multiple_5)+15*plus(multiple_15))
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)
# -*- coding: utf-8 -*-
import numpy as np
N = int(input())
# x, y, z = list(map(int, input().split()))
lis = []
sum_ = 0
for i in range(1, N+1):
    if (i % 3 != 0) and (i % 5 != 0):
        sum_ += i
print(sum_)
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)
N = int(input())
s = 0
for i in range(1,N+1):
  if (i%3!=0 and i%5!=0):
    s+=i
print(s)
N = int(input())
sum = 0

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

print(sum)
total = []

N = int(input())

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:
        total.append(i)

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

a = [i for i in range(N+1)]

for i in range(3, N+1, 3):
    a[i] = 0

for i in range(5, N+1, 5):
    a[i] = 0

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

for i in range(a+1):
    if(i % 3 != 0 and i % 5 != 0):
        ans += i
print(ans)
N = int(input())
count = 0
for i in range(N + 1):
    if i % 3 != 0 and i % 5 != 0:
        count += i
print(count)
N = int(input())
count = 0
for i in range(1, N + 1):
    if i % 15 == 0:
        continue
    elif i % 5 == 0:
        continue
    elif i % 3 == 0:
        continue
    count += i
print(count)
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)
N = int(input())
a = [i+1 for i in range(N)]

S = 0
for x in range(1, N+1):
    if x % 15 == 0:
        a[x-1] = "FizzBazz"
    elif x % 3 == 0:
        a[x-1] = "Fizz"
    elif x % 5 == 0:
        a[x-1] = "Bazz"
    else:
        a[x-1] = x
        S += x
print(S)
n=int(input())
sum=0
for i in range(n+1):
  if i%15==0:
    continue
  elif i%3==0:
    continue
  elif i%5==0:
    continue
  else:
    sum+=i
print(str(sum))
N = int(input())

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

print(sum(target_list))
n = int(input())
A = list(range(1, n+1))
B = list()
for i in range(1, n+1):
    if i % 5 == 0 or i % 3 == 0:
        B.append(i)
ans = list(set(A) - set(B))
print(sum(ans))
n=int(input())
sum=0
for i in range(1,n+1):
    if(i%15!=0 and i%3!=0 and i%5!=0 ):
        sum=sum+i
print(sum)
N = int(input())

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

fizz = 0
for i in range(N//3):
  fizz += i+1
fizz = fizz*3

buzz = 0
for i in range(N//5):
  buzz += i+1
buzz = buzz*5

fizzbuzz =0
for i in range(N//15):
  fizzbuzz += i+1
fizzbuzz = fizzbuzz*15

print(ans - fizz - buzz + fizzbuzz)
a = int(input())
count = 0
for i in range(a):
    if (i + 1) % 3 != 0 and (i + 1) % 5 != 0:
        count += i + 1

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

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

print(ans)
#!/usr/bin/env python3

n = int(input())

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

ans = 0
for i in range(1,n+1):
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        ans += i
        
print(ans)
# ABC 162: B – FizzBuzz Sum
N = int(input())
print(sum([n for n in range(1, N + 1) if n % 3 != 0 and n % 5 != 0]))
N = int(input())
num = []
num2= []
for i in range(N+1):
  if i % 3 == 0 and i % 5 == 0:
    num.append(i)
  if i % 5 == 0:
    num.append(i)
  elif i % 3 == 0:
    num.append(i)
  else:
    num2.append(i)

print(sum(num2))
n = int(input())

a = 0

for i in range(n+1):
    if i % 3 != 0 and i % 5 != 0:
        a += i
print(a)
n=int(input())
ans=0
for i in range(1,n+1):
    if (i%3!=0) and (i%5!=0):
            ans+=i
print(ans)
N = int(input())
A = 0
for i in range(1, N+1):
  if i%3 > 0 and i%5 > 0:
    A += i
print(A)
N = int(input())
sum = 0
for i in range(N+1):
    if i % 3 != 0 and i % 5 !=0:
        sum = sum+i
        
print(sum)
x=input()
y=int(x)
z=int(1)
number=int(0)
while z<=y:
    if z%3==0:
        pass
    elif z%5==0:
        pass
    elif z%15==0:
        pass
    else:
        number=number+z
    z=z+1
print(number)
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))
N = int(input())

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

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

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

print(ans)
n = int(input())

n_l = [i+1 for i in range(n) if not (i+1)%5==0 if not (i+1)%3==0]
print(sum(n_l))
N = int(input())
a = list(range(1,N+1))
b = [i for i in range(1,N+1) if i % 3 == 0] ##3の倍数
c = [i for i in range(1,N+1) if i % 5 == 0] ##5の倍数
d = set(b+c)
A = sum(a)-sum(d)
print(A)
n = int(input())
l = []

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

print(sum(l))
n = int(input())
sum_all = 0
for i in range(1,n+1):
  if i%3 != 0 and i%5 !=0:
    sum_all += i
print(sum_all)
n=int(input())
ans=0
for i in range(1,n+1):
    if i%3!=0:
        if i%5!=0:
            ans+=i
print(ans)
import sys
sys.setrecursionlimit(10**6)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

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


if __name__ == "__main__":
    main()
N=int(input())
s=(N*(N+1))/2-(int(N/3)*3+3)*int(N/3)/2-(int(N/5)*5+5)*int(N/5)/2+(int(N/15)*15+15)*int(N/15)/2


print(int(s))
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(15) * fizzbuzz_sum(n // 15) + fizzbuzz_sum(n % 15)

result = fizzbuzz_sum(n)
print("{}".format(result))
n = int(input())
n3 = n//3
n5 = n//5
n15 = n//15
def sum(k):
    return k*(k+1)//2
ans = sum(n)+15*sum(n15)-3*sum(n3)-5*sum(n5)
print(ans)
a=0
for i in range(1,int(input())+1):
  a+=(not (i%3==0 or i%5==0))*i
print(a)
n = int(input())
an = 0

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

print(an)
n = int(input())
count = 0
for i in range(1, n+1):
  if i%3 != 0 and i%5 != 0:
    count += i
print(count)
n = int(input())
ans = 0
for i in range(1,n+1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
        
print(ans)
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)
n=int(input())
l=[]
for i in range(n+1):
    if i%3==0:
        pass
    elif i%5==0:
        pass
    elif i%15==0:
        pass
    else:
        l.append(i)

        
print(sum(l))
N=int(input())
sum_all=N*(N+1)//2
sum_Fizz=3*(N//3)*(N//3+1)//2
sum_Buzz=5*(N//5)*(N//5+1)//2
sum_FizzBuzz=15*(N//15)*(N//15+1)//2
print(sum_all-sum_Fizz-sum_Buzz+sum_FizzBuzz)
n = int(input())

a = [i for i in range(1, n+1) if i % 3 != 0 and i % 5 != 0]

print(sum(a))
n=int(input())+1
ans=0
for i in range(1,n):
  if i%3==0:
    continue
  elif i%5==0:
    continue
  else:
    ans += i
print(ans)
# coding: utf-8
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)
N = int(input())
lst = []
for _ in range(N+1):
    if _ % 3 == 0 or _ % 5 == 0:
        continue
    else:
        lst.append(_)
print(sum(lst))
import sys

def main():
    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)
if __name__ == '__main__':
    main()
N = int(input())

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