peterverebics/CodeNet_Python_118 huggingface dataset:
s = str(input())
if s.count("7")>0:
	print(True)
else:
	print(False)
n=str(input())
if n[0] ==7 or n[1]==7 or n[2]==7:
  print("Yes")
else:
  print("No")
s = str(input())
if s[0]==7 or s[1]==7 or s[2]==7:
  print('Yes')
else:
  print('No')
import math

K = int(input())
n = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            n += math.gcd(math.gcd(i,j),k)
print(n)
n = input()

if n[0] != 7 and n[1] != 7 and n[2] != 7:
  print("No")
else:
  print("Yes")
x = input().split()
j = 0
for i in x:
  if int(i) != 7:
    j = 1

if j == 0:
  print('Yes')
else:
  print('No')
s=list(input())
print('yes' if '7' in s else 'no')
N = str(input())
a=1
for i in range(len(N)):
    if N[i]=='7':
        a=0
        break
if a==1:
    print('Yes')
else:
    print('No')
a=input()
if '7' in a:
  print("Yes")
else :
  print("NO")
a=str(input())
if a[0] or a[1] or a[2]==7:
    print("Yes")
else:
    print("No")
N = input()



if N[0]=='7':
	print ('Yes')
elif N[1]=='7':
	print ('Yes')
elif N[2]=='7':
	print ('Yes')
else:
  	print ('NO')
# -*- coding: utf-8 -*-
  
N = input()
for i in N:
    if i == '7':
        print('Yes')
        break
ipt = str(input()).split()
if("7" in ipt):
    print("Yes")
else:
    print("No")
N = str(input())
if "7" in N:
    print("yes")
else:
    print("No")
n = int(input())
if 0 <= n % 700 < 100 or 0<= (n % 100) % 70 < 10 or (n % 10) == 7:
  print('Yes')
else:
  print('No')
n = int(input())
ans = 0
for i in range(1,n+1):
    if i%3!=0 and i%5!=0:
        ans += i
    else:
        continue
print(ans)
def ifif(s):
  if s:
    print("Yes")
  else:
    print("No")

###senkei

def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(map(str, input().split()))
def pl(a): print(" ".join(list(map(str, a))))
def ma():return map(int,input().split())
from itertools import accumulate as acc
import operator as op
import copy as cp
import math; import numpy
from bisect import bisect_left as bisl
from bisect import bisect_right as bisr
###
n=ri()
a=[]
for i in range(1,n+1):
    if i%3==0 or i%5==0:
        a.append(0)
    else:
        a.append(i)

print(sum(a))
#!/usr/bin/env python3
import sys


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

if __name__ == '__main__':
    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)
n=int(input())
a=[0]*(n+1)
for i in range(n+1):
    if i%3==0 or i%5==0:
        a[i]=0
    else:
        a[i]=i
print(sum(a))
n = int(input())
a = 0
for i in range(1,n+1):
    if not(i % 3 == 0 or i % 5 == 0):
        a += i
print(a)
n = int(input())
l = []
for i in range(1,n+1):
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        l.append(i)
print(sum(l))
N = int(input())

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

print(total)
n = int(input())
l = [i for i in range(1,n+1) if i%3!=0 and i%5!=0]
print(sum(l))
def FizzBuzzSum():
  N = int(input())
  sum=0
  for i in range(N+1):
    if i%3!=0 and i%5!=0:
      sum=sum+i
  return sum
print(FizzBuzzSum())
def solve(n):
    res = 0
    for i in range(1, n + 1):
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            res += i
    return res


def main():
    n = int(input())
    res = solve(n)
    print(res)


def test():
    assert solve(15) == 60
    assert solve(1000000) == 266666333332


if __name__ == "__main__":
    test()
    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)
a=int(input())
b=a//3
c=a//5
d=a//15
print(a*(a+1)//2-3*b*(b+1)//2-5*c*(c+1)//2+15*d*(d+1)//2)
n = int(input())
m = n + 1
sum = 0
if m <= 3:
  for x in range(m):
    sum = sum + x
else:
  for x in range(m):
    if x%3 == 0 or x%5 == 0:
      pass
    else:
      sum = sum + x
print(sum)
N = int(input())

sum = 0
for i in range(1, N + 1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        sum += i
print(sum)
N = int(input())
fizz = N // 3
buzz = N // 5
fzbz = N // 15
ans = (N+1)*N // 2
ans -= buzz * (5 * buzz + 5) // 2
ans -= fizz * (3 * fizz + 3) // 2
ans += fzbz * (15 * fzbz + 15) // 2
print(ans)
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))
ans = 0
for i in range(1, int(input()) + 1):
    if not (i  % 3 == 0 or i % 5 == 0):
        ans = ans + i
print(ans)
N = int(input())

a = N//15
b = N%15
c = 0

for i in range(b+1):
  if i%3!=0 and i%5!=0:
    c=c+i+15*a

ans=(120*(a*(a-1)/2))+60*(a)+c

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

    print(ans)
    return 0


if __name__ == '__main__':
    main()
n=int(input())
s=0
for i in range(1,n+1):
  if(i%3!=0):
    if(i%5):
      s+=i
    
print(s)
n = int(input())
sum = 0
for i in range (n+1):
    if i%3==0 and i%5==0:
        continue
    elif i%3==0:
        continue
    elif i%5==0:
        continue
    else:
        sum += i
print(sum)
#設定
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()
a = int(input())
num_list = []
for i in range(a):
    i +=1
    if i%3 != 0:
        if i%5 != 0:
            num_list.append(i)
print(sum(num_list))
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(n):
    if (i+1)%3 != 0 and (i+1)%5 !=0:
        ans = ans + i +1
print(ans)
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())

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

ans = 0

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

ret = 0

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

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

print(ans)
def solve(string):
    n = int(string)

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

    return str(f(n) - 3 * f(n // 3) - 5 * f(n // 5) + 15 * f(n // 15))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
ans = 0
n = int(input())

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

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

ans = sum(arr)

print(ans)
#ABC162B
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())

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

def sum_seq(d):
    return 0.5*(n//d)*(2*d+(n//d-1)*d)

print(int(sum_seq(1) - sum_seq(3) - sum_seq(5) + sum_seq(15)))
N = input()
lit_N = []
for i in range(int(N)+1):
  if i % 5 == 0 and i % 3 == 0:
    lit_N.append("FizzBuzz")
  elif i % 3 == 0:
    lit_N.append("Fizz")
  elif i % 5 == 0:
  	lit_N.append("Buzz")
  else:
    lit_N.append(i)
print(sum(list(filter(lambda x: isinstance(x,int), lit_N))))
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 = input("")
N = int(N)
SUM = 0
for i in range(N):
    a = i+1
    if (i+1)%3 != 0:
        if (i+1)%5 != 0:
            SUM = SUM + i+1

print(SUM)
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())
sum=0
for i in range(1,N+1):
    if (i%3!=0)&(i%5!=0):
        sum = sum + i
print(sum)
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=[]
for i in range(1,n+1):
    if i%3==0:l.append(0)
    elif i%5==0:l.append(0)
    else:l.append(i)
print(sum(l))
n = int(input())
ans = 0
for i in range (1, n + 1) :
    if i % 3 != 0 and i % 5 != 0 : ans += i
print(ans)
#B問題
a=int(input())
sum=0
for i in range(1,a+1):
    if(i%3!=0 and i%5!=0):
        sum+=i
print(sum)
if __name__ == "__main__":
    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)
#B

n = int(input())
s = 0
for i in range(1,n+1):
    #print(i,i % 3,i % 5)
    if i % 3 != 0 and i % 5 != 0:
        s += i
    #print(s)
print(s)
N = int(input())
ans = 0
for i in range(N+1):
    if i % 3 == 0:
        continue
    if i % 5 == 0:
        continue
    ans += i
print(ans)
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) & (i%5!=0):
    ans = ans +i
print(ans)
n = int(input())
ans = 0
for x in range(n + 1):
    if x % 3 == 0 or x % 5 == 0:
        pass
    else:
        ans += x
print(ans)
# 入力
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)
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 not (i%3 == 0 or i%5 == 0):
        ans += i
print(ans)
def extract(seq):
    arr = []
    for i in seq:
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            arr.append(i)
    return sum(arr)


n = int(input())
print(extract(range(1, n + 1)))
n = int(input())
a = 0

for n in range(1,n+1):
    if n % 3 != 0 and n % 5 != 0:
        a +=  n
print(a)
n=int(input())
sum=0
for i in range(n):
	if (i+1) % 3 !=0:
		if (i+1)%5 !=0:
			sum+=i+1
print(sum)
#2問目
sum = 0
N = int(input())
for i in range(1, N+1):
    if(i %3 != 0 and i %5 != 0):
        sum += i
print(sum)
N = int(input().strip())
s = 0
for i in range(1,N+1):
    if i%3 and i%5:
        s+=i
print(s)
N = int(input())
s = 0
for n in range(1, N + 1):
    if n % 3 == 0:
        continue
    if n % 5 == 0:
        continue
    s = s + n

print(s)
n = int(input())
s1 = set()
s2 = set()
a = 1
b = 1
while a <= n:
    if a % 3 == 0:
        s1.add(a)
    a += 1
while b <= n:
    if b % 5 == 0:
        s2.add(b)
    b += 1
s3 = set(range(1,n + 1))
s12 = s1 | s2
s4 = s3 - s12
c = 0
for x in s4:
    c += x
print(c)
N = int(input())
S = 0
for i in range(1, N+1):
    if i%3==0 or i%5==0 or (i%3==0 and i%5==0):
        continue
    S+=i
print(S)
n = int(input())
arr = [0 for i in range(n)]
for i in range(n):
    it = i+1
    if not ((it %3 == 0 and it%5==0) or it%3 == 0 or it%5 == 0):
        arr[i] = i+1
# print(arr)
print(sum(arr))
n = int(input())

zenbu = n * (n + 1) / 2

A = (sum(i for i in range(1, n + 1) if i % 3 == 0))
B = (sum(i for i in range(1, n + 1) if i % 5 == 0))
C = (sum(i for i in range(1, n + 1) if i % 15 == 0))

D = zenbu - A - B + C

print(int(D))
n = int(input())

ans = sum(range(1, n+1)) - sum(range(3, n+1, 3)) - sum(range(5, n+1, 5)) + sum(range(15, n+1, 15))

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

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

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

n = int(input())
q3 = n // 3
q5 = n // 5
q15 = n // 15

out = n * (n+1) // 2 - ( 3 * q3 * (q3+1) // 2 + 5 * q5 * (q5+1) // 2) + 15 * q15*(q15+1) // 2
print(out)
n = int(input())
a = 0
for i in range(1,n+1):
    if not ((i%3 == 0)or (i%5 == 0)):
        a += i
print(a)
N = int(input())
A = []
for i in range(N+1):
    if i % 3 != 0 and i % 5 != 0:
        A.append(i)
print(sum(A))
N=int(input())

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

total = 0

for i in range(1, n+1):
  if i % 15 == 0:
      continue
  elif i % 3 == 0:
      continue
  elif i % 5 == 0:
      continue
  else:
      total += i
    
print(total)
a=int(input())
b=(sum(range(3,a+1,3)))
c=(sum(range(5,a+1,5)))
d=(sum(range(15,a+1,15)))
e=a*(a+1)/2
print(int(e-b-c+d))
n = int(input())

k_5 = n // 5
k_3 = n // 3
k_15 = n // 15

sum_5 = 5 * k_5 * (k_5 + 1) / 2 
sum_3 = 3 * k_3 * (k_3 + 1) / 2 
sum_15 = 15 * k_15 * (k_15 + 1) / 2 
sum_n = n * (n+1) / 2

answer = sum_n - sum_3 - sum_5 +sum_15
print(int(answer))
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_list = [1,3,3,7,7,7,14,22,22,22,33,33,46,60,60]
N_add15 = [1,2,2,3,3,3,4,5,5,5,6,6,7,8,8]


num_15 = N // 15

n_list = N_list[N%15-1] + 15 * N_add15[N%15-1] * (num_15)

if(N < 16):
    ans = N_list[N-1]
else:
    ans = num_15 * num_15 * 60 + n_list

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

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

print(rslt)
N=int(input())
a=0
for i in range(1, N+1):
  if i % 15 == 0:
    continue
  if i % 3 == 0:
    continue
  if i % 5 == 0:
    continue
  a += i
print(a)
n=int(input())
ans = 0

loop = n//15
ans += loop * 60 + 120*(loop-1)*loop//2
res = n % 15
for i in range(1,res+1):
  if i%3 != 0 and i%5 != 0:
    ans += 15*loop + i
  
print(ans)
n = int(input())
lst = [i for i in range(1, n+1) if i % 3 != 0 and i % 5 != 0]
print(sum(lst))
a = int(input())
li = list(range(1, (a + 1)))
for i in range(a):
    if li[i] % 3 == 0 or li[i] % 5 == 0 or li[i] % 15 == 0:
        li[i] = 0
print(sum(li))
N = int(input())

numbers = [n for n in range(1, N + 1) if n % 3 != 0 and n % 5 != 0]
print(sum(numbers))
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 or i % 5 == 0:
		continue
	else:
		ans += i
print(ans)
N=int(input())
ans=0
for n in range(N):
  n+=1
  if n%5!=0 and n%3!=0:
    ans+=n
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(1, N+1):
    if i%15 != 0 and i%3 != 0 and i%5 != 0:
        result += i
print(result)
n=int(input())
out=0
for i in range (1,n+1):
    if i%3!=0 and i%5!=0:
        out=out+i
print(out)
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()
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())

c = 0

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

print(c)
N = int(input())

n = 0
for i in range(1, N+1):
    if i % 5 != 0 and i % 3 != 0:
        n += i
print(n)
#!/usr/bin/env python3
import sys


def solve(N: int):
    answer = 0
    for i in range(1,N+1):
        if i%3 == 0 or i%5 == 0:
            continue
        else:
            answer += i
    print(answer)
    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))  # type: int
    solve(N)

if __name__ == '__main__':
    main()
N=int(input())

a=N//5
b=N//3
c=N//15

sum=N*(N+1)/2-5*a*(a+1)/2-3*b*(b+1)/2+15*c*(c+1)/2

print(int(sum))
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)
N = int(input())

count = 0
for i in range(1, N+1):
    if i % 3 == 0 and i % 5 == 0:
        #print("FizzBuzz")
        pass
    elif i % 3 == 0:
        #print("Fizz")
        pass
    elif i % 5 == 0:
        #print("Buzz")
        pass
    else:
        count += i
print(count)
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)
N = int(input())
sum = 0

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

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

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

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

print(ans)
#!/usr/bin/env python3
n = int(input())


def e(k):
    m = n // k
    print
    return (m + 1) * m // 2 * k


print(e(1) - e(3) - e(5) + e(15))
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)
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def sums(a, N): 
    ans = ((N//a)*((N//a)+1)//2)*a
    return ans 


def solve():
    N = read_int()
    return N*(N+1)//2-(sums(3, N)+sums(5, N)-sums(15, N)) 


if __name__ == '__main__':
    print(solve())
n = int(input())
sum = 0

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

print(count)
N = int(input())

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

print(cnt)
n = int(input())
import numpy as np
d = np.array(range(1,n+1))
print(np.sum(d) - np.sum(d[d%3==0]) - np.sum(d[d%5==0]) + np.sum(d[d%15==0]))
import sys
from decimal import *
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


def main():
    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)


main()
n = int(input())
a=0
for i in range(1, n+1):
  if i%3!=0 and i%5!=0:
    a=a+i
print(a)
N = int(input().strip())
def hoge(N, r):  # 1-Nのrの倍数の和
  R = N-(N%r)  # N以下の一番大きいrの倍数を知りたい
  n = R//r
  return n*(n+1)//2*r

ans = hoge(N,1) - hoge(N,3) - hoge(N,5) + hoge(N,15)
print(ans)
a = int(input())
sum = 0
for i in range(1,a+1):
    if(i % 3==0 or i % 5==0 or i% 15 == 0):
        continue
    else:
        sum += i

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

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

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

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

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

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

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

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

total = []


for i in range(1, n + 1):
    if i % 15 == 0:
        "FizzBuzz"
    elif i % 5 == 0:
        "Buzz"
    elif i % 3 == 0:
        "Fizz"
    else:
        total.append(i)  # リストに加える
print(sum(total))
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)
# coding: utf-8
N = int(input())

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

while (i < N):
    if lst[i] % 3 == 0 and lst[i] % 5 == 0:
        lst[i] = 0
    elif lst[i] % 3 == 0:
        lst[i] = 0
    elif lst[i] % 5 == 0:
        lst[i] = 0
    i = i + 1;

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

ans=[]
for i in range(n+1):
  if i%3==0 and i%5==0:
    ans.append(0)
  if i%3==0 or i%5==0:
    ans.append(0)
  else:
    ans.append(i)
print(sum(ans))
N = int(input())
wa = 0
for i in range(1,N+1):
	if i % 3 != 0 and i % 5 != 0:
		wa += i
print(wa)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)


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


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())
sumN = N*(N+1)/2
sumFizz = ((N//3)*((N//3)+1))*3/2
sumBuzz = ((N//5)*((N//5)+1))*5/2
sumFizzBuzz = ((N//15)*((N//15)+1))*15/2
print(int(sumN - sumFizz - sumBuzz + sumFizzBuzz))
def main():
  count = 0
  for i in range(1,int(input())+1):
    if i % 3 == 0:
      continue
    if i % 5 == 0:
      continue
    count += i
  return count
    
print(main())