peterverebics/CodeNet_Python_118 huggingface dataset:
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())
C=[]
for i in range(N):
    if (i+1)%3==0 or (i+1)%5==0:
        continue
    else:
        C.append(i+1)

print(sum(C))
a = int(input())
n3 = a//3
n5 = a//5
n15 = a//15
ans = a*(a+1)//2 - 3*n3*(n3+1)//2 - 5*n5*(n5+1)//2 + 15*n15*(n15+1)//2
print(ans)
ans=0
for i in range(1,int(input())+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
    ans += i
print(ans)
n= int(input())
def wg(t):
    tp=n//t
    return t*(tp*(tp+1)//2)
print(n*(n+1)//2-wg(3)-wg(5)+wg(15))
n=int(input())
result=0
for i in range(n+1): 
    if i % 3 == 0 and i % 5 == 0:
        result=result    
    elif i % 3 == 0:
        result=result
    elif i % 5 == 0:
        result=result
    else:
        result=result+i
    
print(result)
n = int(input())
sum = 0

for i  in range (n):
    i += 1
    if (i%3==0 and i%5==0) or i%3==0 or i%5==0:
        continue
    else:
        sum += i
print(sum)
a = int(input())
res = (1 + a) * a // 2
three, five, fifteen = 0, 0, 0
if res >= 3:
    three = (3 + a // 3 * 3) * (a // 3) //2
if res >= 5:
    five = (5 + a // 5 * 5) * (a // 5) //2
if res >= 15:
    fifteen = (15 + a // 15 * 15) * (a // 15) //2

print(res - three - five + fifteen)
from math import gcd


def lcm(a, b):
    return a * b // gcd(a, b)


def total(x):
    return x * (n // x) * (n // x + 1) // 2


n = int(input())
# a, b = map(int, input().split())
a, b = 3, 5

print(total(1) - total(a) - total(b) + total(lcm(a, b)))
N=int(input())

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

print(count)
N = int(input())
tot_sum = 0
for val in range(1, N + 1):
    if (val % 5 == 0) or (val % 3 == 0):
        continue
    else:
        tot_sum += val

print(tot_sum)
N = int(input())

ans = 0
for i in range(N+1):
    if i % 15 == 0:
        continue
    if i % 3 == 0:
        continue
    if i % 5 == 0:
        continue
    ans += i
print(ans)
n=int(input())
li=[]
for i in range(1,n+1):
    li.append(i)
sum=0
for j in li:
    if j%15==0:
        sum+=j
    elif j%3==0:
        sum+=j
    elif j%5==0:
        sum+=j
print(int(((n+1)*n/2) - sum))
n = int(input())
s = []
for i in range(n+1):
  if i%3!=0 and i%5!=0:
       s.append(i)
print(sum(s))
N = int(input())
list1 = []
for i in range(N+1):
  if i%3 ==0 or i%5 ==0:
    list1.append(i)

total1 =0
total2 = 0
for i in list1:
  total1 += i
for i in range(N+1):
  total2 += i
print(total2 -total1)
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(N: int):
    ret = 0
    for i in range(1, N + 1):
        if i % 3 and i % 5:
            ret += i
    print(ret)
    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()
def main():
	N = int(input())
	s = 0
	for i in range(1, N + 1):
		if i % 5 == 0 or i % 3 == 0:
			continue
		s += i
	print(s)
	return 0

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)
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)
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)
# 162b

N = int(input())
sum = 0 # 数字の場合の和を格納する変数

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

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

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

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

result = 0

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

print(result)
def main():
    N = int(input())
    
    counter = 0
    l = []
    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:
            # print(i)
            counter += i
            
    print(counter)            
        
    
main()
number = int(input())

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

print(ans)
n=int(input())
s=(n+1)*n//2
a=3*(n//3+1)*(n//3)//2
b=5*(n//5+1)*(n//5)//2
c=15*(n//15+1)*(n//15)//2
print(s-a-b+c)
n = int(input())

##１からnの合計値
sum = 0
for i in range(1, n + 1):
	sum = sum + i

##まずは3の倍数を引く
i3 = n // 3
for i in range(1, i3 + 1):
	sum = sum - 3 * i

##次に5の倍数を引く。15の倍数は引かなくていい
i5 = n // 5
for i in range(1, i5 + 1):
	if (i % 3 != 0):
		sum = sum - 5 * i

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

print("{}".format(ret))
print(sum(i%3>0<i%5and i for i in range(int(input())+1)))
n=int(input())
ans=0
for i in range(n):
  i+=1
  if i%3!=0 and i%5!=0:
    ans+=i
print(ans)
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)
i = int(input())
ans = 0
for ii in range(1,i+1):
    if ii % 3 == 0:
        pass
    elif ii % 5 == 0:
        pass
    elif ii % 15 == 0:
        pass
    else:
        ans += ii

print(ans)
print(sum(map(lambda i: 0 if i%3 == 0 or i%5 == 0 else i,[i+1 for i in range(int(input()))])))
N = int(input())
a_i = 0
for i in range(1, N+1):
    if i % 3 != 0:
        if i % 5 != 0:
            a_i += i
print(a_i)
n=int(input())+1
c=0
for i in range(1,n):
    if i%3!=0 and i%5!=0:
        c+=i
print(c)
a = int(input())

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

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

cnt = 0
for i in range(1, n + 1):
    if i % 3 != 0 and i % 5 != 0:
        cnt += i
print(cnt)
from collections import defaultdict
import math
# N, K = map(int, input().split(' '))
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)
def main(n: int):
    ans = 0
    for i in range(1, n + 1):
        if i % 15 == 0:
            continue
        if i % 5 == 0:
            continue
        if i % 3 == 0:
            continue

        ans += i

    print(ans)


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

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

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

    total += v

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

result = 0

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

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

f = n//3
b = n//5
fb = n//15

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

ans = s(n) - 3*s(f) - 5*s(b) + 15*s(fb)
print(int(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)
n = int(input())
sum_a = 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:
        sum_a = sum_a + i
print(sum_a)
a = int(input())
ans = 0
i = 1
while i <= a:
    if i%15 == 0:
        i += 1
        continue
    elif i%3 == 0:
        i += 1
        continue
    elif i%5 == 0:
        i += 1
        continue
    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:
        ans += i

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

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

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


n = int(input())
ans = 0

for i in range(n):
    ans += CheckFizBuzz(i+1)

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

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


main()
sum=0
n=int(input(""))
for i in range(1,n+1):
    if i%3!=0 and i%5!=0:
        sum+=i
print(str(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())
out = 0
for i in range(1, n+1):
    if i % 3 != 0 and i % 5 != 0:
        out += i
print(out)
import numpy as np
import math
import statistics
import collections

def solve():
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        bit = 0
        if i % 3 != 0:
            bit += 1
        if i % 5 != 0:
            bit += 1
        if bit == 2:
            ans += i
    print(ans)
    return 0

if __name__ == "__main__":
    solve()
def result(N):
    answer=0
    for i in range(N+1):
        if(i%3!=0):
            if(i%5!=0):
                answer+=i
    return answer

N = int(input())
print(result(N))
N = int(input())
answer = 0
for i in range(1, N + 1):
    if i % 3 != 0 and i % 5 != 0:
        answer += i
print(answer)
S=int(input())
a=int(S/15)
b=S%15
c=int(b/3)
d=int(b/5)
alls=(1+S)*S/2
print(int(alls-(60*a)-(105*a*(a-1)/2)-((1+c)*c*3/2)-((1+d)*d*5/2)-(c+d)*15*a))
def resolve():
    n=int(input())
    a=0
    for i in range(1,n+1):
        if i%3!=0 and i%5!=0:
            a+=i
    print(a)
resolve()
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())
li = 0
for i in range(1,N+1,1):
  if i % 3 != 0 and i % 5 != 0 :
    li += i
print(li)
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())

count = 0

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


print(count)
data = [False] * 1000001

for i in range(1, 1000001):
  if i % 3 == 0 or i % 5 == 0:
    continue
  data[i] = True

n = int(input())
result = 0

for i in range(1, n + 1):
  if data[i]:
    result += i

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

lfb=[]
l=[]

for i in range(1,n+1):
    if i%3==0:
        lfb.append(i)
    elif i%5==0:
        lfb.append(i)
    elif i%15==0:
        lfb.append(i)
    else:
        l.append(i)
print(sum(l))
N = int(input())
ans = 0
for i in range(1,N+1):
    if not i%3 == 0:
        if not i%5 == 0:
            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)
N = int(input())
sum = 0

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

print(sum)
import sys
import numpy as np

N=int(input())
A=np.arange(N+1)
count = 0

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

def fizzbazzz(x):
    if x%3==0 or x%5 == 0:
        return 0
s = 0
for i in range(N):
    if fizzbazzz(i+1)!=0:
        s += i + 1
print(s)
N = int(input())
sum = 0
for i in range(1, N + 1):
    if i % 3 == 0 or i % 5 == 0:
        sum += 0
    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)
i=int(input())
i1=i*(i+1)//2
i2=i//3
i3=i//5
i4=i2*(i2+1)//2
i5=i3*(i3+1)//2
i6=i//15
i7=i6*(i6+1)//2
print(i1-i4*3-i5*5+i7*15)
N = int(input())
ans = 0
for a in range(1, N+1):
    if a % 3 != 0 and a % 5 != 0:
        ans += a

print(ans)
k=int(input())
j=0
for i in range(k+1):
    if i%3==0 or i%5==0:
        o=0


    else :
        j=j+i

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

print(x)
N = int(input())

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

print(cnt)
import sys
input = sys.stdin.buffer.readline

N = int(input())

answer = 0
for i in range(1, N + 1):
    if i % 3 and i % 5:
        answer += i
print(answer)
# -*- coding: utf-8 -*-
N = int(input())
sum1 = 0
for i in range(N+1):
    if i%3!=0 and i%5!=0:
        sum1 += i
print(sum1)
N = int(input())
c=0
for i in range (1,N+1):
  if i%15==0:
    c += 0
  elif i%3==0:
    c += 0
  elif i%5==0:
    c += 0
  else:
    c += i
    
print(c)
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):
  if i % 3 == 0 or i % 5 == 0:
    continue
  else: 
    sum += i
print(sum)
N=int(input())

total=0
for i in range(N+1):
  if i%3!=0 and i%5!=0:
    total+=i
    
print(total)
def fizzbuzz_sum(n):
    if n % 3 == 0 and n % 5 == 0:
        return 0
    elif n % 3 == 0:
        return 0
    elif n % 5 == 0:
        return 0
    else:
        return n


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

    for i in range(1, n+1):
        sum += fizzbuzz_sum(i)

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


def fizzBuzz(n):

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


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

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

for i in range(input_line + 1):
    if i % 15 == 0 or i % 5 == 0 or i % 3 == 0:
        pass
    else:
        fizzbuzz_list.append(i)
print(sum(fizzbuzz_list))
n = int(input())
num = 0
for i in range(1,n+1):
    if i%3 != 0 and i%5 != 0:
        num += i
print(num)
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)
import sys

# import bisect
# from collections import Counter, deque, defaultdict
# import copy
# from heapq import heappush, heappop, heapify
# import itertools
# from operator import attrgetter, itemgetter
# import math

# from numba import jit

# import numpy as np

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

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

print(ans)
num = int(input())
ans = sum([i for i in range(1, num + 1) if i % 3 > 0 and i % 5 > 0])
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())
a=list(range(N+1))
b=list()
i=0
for i in range(N+1):
    if a[i]%3==0:
      b.append(0)
    elif a[i]%5==0:
      b.append(0)
      
    else:
      b.append(a[i])
print(sum(b))
N = int(input())

sum_all_numbers = ((N + 1) * N) // 2
sum_mul_of_3 = sum([i for i in range(1, N+1) if i % 3== 0])
sum_mul_of_5 = sum([i for i in range(1, N+1) if i % 5 == 0])
sum_mul_of_15 = sum([i for i in range(1, N+1) if i % 15 == 0])

print(sum_all_numbers - sum_mul_of_3 - sum_mul_of_5 + sum_mul_of_15)
N=int(input())
count=0
a=0
for i in range(N+1):
  if i%15==0 or i%3==0 or i%5==0:
    a+=1
  else:
    count+=i
    
print(count)
def wa(n):
    return n * (n+1) // 2


N = int(input())

print(wa(N) - wa(N//3) * 3 - wa(N // 5) * 5 + wa(N // 15) * 15)
n = int(input())
ans = 0

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

k = N // 15
ans = 0

ans += 60 * k + 15 * 8 * int(k*(k-1)/2)

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

    print(ans)


if __name__ == "__main__":
    main()
n = int(input())
sum_n = (1+n)*n/2
a = 3*(1+n//3)*(n//3)/2
b = 5*(1+n//5)*(n//5)/2
c = 15*(1+n//15)*(n//15)/2
print(int(sum_n - a - b + c))
N=int(input())
cnt=0
for i in range(1,N+1):
  if i%3==0:
    continue
  if i%5==0:
    continue
  if i%15==0:
    continue
  else:
    cnt+=i
print(cnt)
N = int(input())
ans = 0
for x in range(1,N+1):
    if(x % 3 == 0):
        ans += 0
    elif(x % 5 ==0):
        ans += 0
    else:
        ans += x
        #print(x)

print(ans)
n = int(input())
x = 0
for i in range(1, n+1):
    if i%3 and i%5:
        x+=i
print(x)
n=int(input())
ans=(n*(n+1))//2
x=n//3
ans -= (((x)*(x+1))//2)*3
x=n//5
ans -= (((x)*(x+1))//2)*5
x=n//15
ans += (((x)*(x+1))//2)*15
print(ans)
N = int(input())
a = []
for i in range(N):
    a.append(i+1)
    if a[i] % 15 == 0:
        a[i] = 0
    elif a[i] % 5 == 0:
        a[i] = 0
    elif a[i] % 3 == 0:
        a[i] = 0

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

print(s)
print(sum([i for i in range(1,int(input())+1) if not ((i%3==0 and i%5==0) or i%3==0 or i%5==0)]))
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())
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())
ns = set(range(1,N+1))
n3 = set(range(0,N+1,3))
n5 = set(range(0,N+1,5))
print(sum(ns-n3-n5))
N = int(input())
res = 0
for i in range(1,N+1):
    if i%15==0:
        dp = 0
    elif i%5==0:
        dp = 0
    elif i%3==0:
        dp = 0
    else :
        dp = i
    res = res+dp
print(res)
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)
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())

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

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

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

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

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

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

print(total)
print(sum(i for i in range(int(input())+1) if (i%3!=0 and i%5!=0)))
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)
from collections import deque
import math; floor,ceil = math.floor,math.ceil
import sys; input = lambda: sys.stdin.readline().rstrip()
aint = lambda: int(input()); ints = lambda: list(map(int, input().split()))
Yes = lambda boolean: print('Yes') if boolean else print('No')
YES = lambda boolean: print('YES') if boolean else print('NO')
is_even = lambda x: True if x%2==0 else False
s = lambda x: int(x*(x+1)*0.5)

def main():
    n = aint()
    print(s(n)-3*s(int(n/3))-5*s(int(n/5))+15*s(int(n/15)))

if __name__ == '__main__':
    main()
from math import *
 
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)
N = int(input())
a = N//3
b = N//5
c = N//15
print(int((1+N)*N/2-((3*(a+1)*a/2)+(5*(b+1)*b/2)-(15*(c+1)*c/2))))
n = int(input())
ans = 0
for i in range(n+1):
    if not (i % 3 == 0 or i % 5 == 0 or i % 15 == 0):
        ans += i
print(ans)
n = int(input())

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

print(res)
# FizzBuzz列の N項目 までに含まれる数の和を求めてください。

N = int(input())
answer = 0

for i in range(1, N + 1):
    if i % 3 != 0 and 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())
d3 = n // 3
d5 = n // 5
d15 = n // 15

print(int(n*(n+1)/2 + 15*d15*(d15+1)/2 - 3*d3*(d3+1)/2 - 5*d5*(d5+1)/2))
N = int(input())
sum=0
for i in range(1,N+1,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())
sum=0

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

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

fizzbuzz = []

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

num = [int(s) for s in fizzbuzz]
print(sum(num))