Harryxun/stf_run huggingface dataset:
n, m, x, y = map(int, input().split())
xs = max(list(map(int, input().split())).append(x))
ys = min(list(map(int, input().split())).append(y))
print('No War' if xs < ys else 'War')

### FIXED CODE ###

n,m,x,y = map(int,input().split())
xs = max(list(map(int,input().split())))
ys = min(list(map(int,input().split())))
ans = 'War'
if xs+1 <= ys:
    for i in range(xs+1,ys+1):
        if x < i <= y:
            ans = 'No War'
            break
print(ans)
n = int(input())
result = n % 1000

pirnt(result)

### FIXED CODE ###

n = int(input())
result = 1000 - n % 1000

if result == 1000:
    print(0)
else:
    print(result)
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
n = ni()
x = input()
xr = x[::-1]
px = x.count("1")
def solve(t):
    ret = 1
    while t>0:
        p = bin(t).count("1")
        t %=p
        ret +=1
    return ret
x_tp = 0
x_tm = 0

for i in range(n):
    x_tp = (x_tp + int(xr[i])*pow(2,i,px+1) ) %(px+1) ## 0->1
if px>0:
    for i in range(n):
        x_tm = (x_tm + int(xr[i])*pow(2,i,px-1) ) %(px-1) # 1->0
ans = []
for i in range(n):
    if xr[i] =="0":
        x_tmp = (x_tp + pow(2,i,px+1) ) %(px+1)
    else:#1->0
        x_tmp = (x_tm - pow(2,i,px-1)) %(px-1)
    t = solve(x_tmp)
    ans.append(t)
for i in range(n-1,-1,-1):
    print(ans[i])


### FIXED CODE ###

ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
n = ni()
x = input()
xr = x[::-1]
px = x.count("1")
def solve(t):
    ret = 1 #最初の一回
    while t>0:
        p = bin(t).count("1")
        t %=p
        ret +=1
    return ret
x_tp = 0
x_tm = 0

for i in range(n):
    x_tp = (x_tp + int(xr[i])*pow(2,i,px+1) ) %(px+1) ## 0->1
if px>1:
    for i in range(n):
        x_tm = (x_tm + int(xr[i])*pow(2,i,px-1) ) %(px-1) # 1->0
ans = []

for i in range(n):
    if xr[i] =="0":
        x_tmp = (x_tp + pow(2,i,px+1) ) %(px+1)
    else:#1->0
        if px==1:
            ans.append(0)
            continue
        x_tmp = (x_tm - pow(2,i,px-1)) %(px-1)
    t = solve(x_tmp)
    ans.append(t)
for i in range(n-1,-1,-1):
    print(ans[i])
import numpy as np
n,k = map(int, input().split())
l = np.zeros(n)
for i in range(k):
    d = int(input())
    a = map(int, input().split())
    for j in range(d):
        l[a[j]-1] = 1
ans = 0
for i in l:
    if(i == 0):
        ans += 1
print(ans)


### FIXED CODE ###

import numpy as np
n,k = map(int, input().split())
l = [0 for i in range(n)]
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in a:
        l[j-1] = 1

print(l.count(0))
N = int(input())

arr = [ int(input()) for i in range(N)]

arr.sort()
cnt = 0
num = 1

a = arr[0]

for i in range(1,N):
  if arr[i] == a:
    num += 1
  else:
    num = 1
    if num % 2 == 1:
      cnt += 1
printx(int(cnt))

### FIXED CODE ###

N = int(input())

arr = [ int(input()) for i in range(N)]

arr.sort()
cnt = 0
num = 1

a = arr[0]

for i in range(1,N):
  if arr[i] == a:
    num += 1
  else:
    if num % 2 == 1:
      cnt += 1
    num = 1
    a = arr[i]
if num % 2 == 1:
  cnt += 1

print(int(cnt))
N = int(input().strip())
x = [[] for x in range(N)]
for i in range(N-1):
     u, v, w = list(map(int, input().split()))
     x[u-1].append([v-1, w])
     x[v-1].append([u-1,w])



ret = {}
done = []

queue = [0]

for i in range(N):
    curr = queue.pop()
    if curr == 0:
        ret[0] = 0

    for neigh in x[curr]:
        if neigh in done:
            continue
        if neigh[1] % 2 == 0:
            ret[neigh[0]] = ret[curr]
        else:
            ret[neigh[0]] = 0 if ret[curr] == 1 else 1

        queue.append(neigh[0])
    done.append(curr)


for i in range(N):
    print(ret[i])


### FIXED CODE ###

import math
N, K = map(int, input().strip().split())

ret = 0

for i in range(N):
    if (i + 1) < K:
        ret += (1.0 / N) * (0.5 ** (math.ceil(math.log2(K / (i+1)))))
    else:
        ret += (1.0 / N)
print(ret)
# YouTube解説
MOD = 1000000007
n, k = [int(x) for x in input().split()]
d = [0] * (k + 1)

for i in range(0, k + 1):
    d[i] = pow(k // i, n, MOD)

for i in range(k, 0, -1):  # 大きいほうから
    for j in range(i * 2, k + 1, i):  # iの倍数
        # d[6] = d'[6] - d[12] - d[18] ...
        d[i] -= d[j]
        d[i] %= MOD
ans = 0
for i, item in enumerate(d):
    ans += i * item
    ans %= MOD
print(ans)


### FIXED CODE ###

# YouTube解説
MOD = 1000000007
n, k = [int(x) for x in input().split()]
d = [pow(k // i, n, MOD) for i in range(1, k + 1)]
d.insert(0, 0)

for i in range(k, 0, -1):  # 大きいほうから
    for j in range(i * 2, k + 1, i):  # iの倍数
        # d[6] = d'[6] - d[12] - d[18] ...
        d[i] -= d[j]
        d[i] %= MOD
ans = 0
for i, item in enumerate(d):
    ans += i * item
    ans %= MOD
print(ans)
n = int(raw_input())
a = []
a.append(int(raw_input()))
Min = a[0]
Max = -1*10**9
for j in range(1,n):
    a.append(int(raw_input()))
    Max = max(Max,R[j]-Min)
    Min = min(Min,R[j])
print Max

### FIXED CODE ###

n = int(raw_input())
a = []
a.append(int(raw_input()))
Min = a[0]
Max = -1*10**9
for j in range(1,n):
    a.append(int(raw_input()))
    Max = max(Max,a[j]-Min)
    Min = min(Min,a[j])
print Max
n = int(input())
a = [input() for i in range(n)] 
ans = 1
s = [a[0]]
 
for i in a[1:]:
    if not i in s:
        ans += 1
        s.append(i)
print(ans) 

### FIXED CODE ###

import collections
N=int(input())
S=[]
for i in range(N):
    S.append(input())
s=collections.Counter(S)
s_key=s.keys()
print(len(s_key))
k = int(input())
s = input()

if len(s) >= k:
    s = s[0:k]

print(s)

### FIXED CODE ###

n = int(input())

n = n % 10

if n in (2,4,5,7,9):
    yomi = 'hon'
if n in (0,1,6,8):
    yomi = 'pon'
if n == 3:
    yomi = 'bon'

print(yomi)
import numpy as np

X, N= map(int,input().split())
P = list(map(int, input().split()))

if N == 0:
    print(X)
else:
    A = [i for i in range(1,101)]

    for i in P:
        A.remove(i)

    a = (np.array(A) - X)**2
    j = np.argmin(a)
    if (A[j] - X)**2 >= X**2:
        print(0)
    else:
        print(A[j])

### FIXED CODE ###

import numpy as np

X, N= map(int,input().split())
P = list(map(int, input().split()))
P = list(set(P))

if N == 0:
    print(X)
else:
    A = [i for i in range(1,210)]

    for i in P:
        A.remove(i)

    a = (np.array(A) - X)**2
    j = np.argmin(a)
    if (A[j] - X)**2 >= X**2:
        print(0)
    else:
        print(A[j])
a,b,c=map(int, input().split())
 
print max((c-(a-b)),0)

### FIXED CODE ###

a,b,c=map(int, input().split())
 
print(max((c-(a-b)),0))
n = int(raw_input())
score = [0,0]

for i in range(n):
    t, h = raw_input().split()
    if t < h:
        score[1] += 3
    elif t > h:
        score[0] += 3
    else:
        score += 1
print score[0], score[1]

### FIXED CODE ###

score = [0, 0]

n = int(raw_input())
for i in range(n):
    t, h = raw_input().split()
    if t < h:
        score[1] += 3
    elif t > h:
        score[0] += 3
    else:
        score[0] += 1
        score[1] += 1
print score[0], score[1]
from collections import deque
I = lambda: map(int, input().split())
n, m = I()
bridges = [list(I()) for _ in range(m)][1:]
*set_numbers, = range(n+1)
sets = [{i} for i in range(n+1)]
cnt = n*(n-1)//2
cnts = [cnt]
end_set_number = n
for a, b in bridges[::-1]:
    a, b = set_numbers[a], set_numbers[b]
    if a == b: continue
    set_1, set_2 = sets[a], sets[b]
    cnt -= len(set_1)*len(set_2)
    cnts += max(cnt, 0),
    new_set = set_1|set_2
    sets += new_set,
    end_set_number +=1
    for i in new_set:
        set_numbers[i] = end_set_number
print(*cnts[::-1])

### FIXED CODE ###

a, b, c = map(int, input().split())
print(min(c, b//a))
n,m,k = map(int,input().split())

for i in range(m+1):
  if k - n*i < 0:
    print('No')
    exit()
  if (k - n*i) % (m - 2*i) == 0:
    print('Yes')
    exit()

### FIXED CODE ###

n,m,k = map(int,input().split())

for i in range(m+1):
  for j in range(n+1):
    if n*i + m*j - 2*i*j == k:
      print('Yes')
      exit()
print('No')
import numpy as np
N=int(input())
A=np.array(list(map(int,input().split())))
B=np.array(list(map(int,input().split())))
AB=np.array([(a,b) for a,b in zip(A,B)])
AB=AB[np.argsort(AB[:, 1])]
AI=np.array([(i,AB[i,0]) for i in range(N)])
AI=AI[np.argsort(AI[:, 1])]
sigma=np.array([AI[i,0] for i in range(N)])
ASort=np.array([AI[i,1] for i in range(N)])
BSort=np.array([AB[i,1] for i in range(N)])
g=0
for i in range(N):
    if ASort[i]>BSort[i]:
        g=1
        break
counter=0
if g==0:
    used=np.array([])
    for i in range(N):
        if not(i in used):
            counter+=1
            if counter==2:
                break
            start=i
            np.append(used,i)
            now=sigma[start]
            np.append(used,now)
            while start!=now:
                now=sigma[now]
                np.append(used,now)
if counter!=2 or g==1:
    print("No")
else:
    print("Yes")


### FIXED CODE ###

import numpy as np
N=int(input())
A=np.array(list(map(int,input().split())))
B=np.array(list(map(int,input().split())))

AB=np.array([(A[i],B[i]) for i in range(N)])
AB=AB[np.argsort(AB[:,1])]

AI=np.array([[i,AB[i,0]] for i in range(N)])
AI=AI[np.argsort(AI[:,1])]

sigma=AI[:,0]
ASort=AI[:,1]
BSort=AB[:,1]

g=0
f=0
for i in range(N):
    if ASort[i]>BSort[i]:
        g=1
        break

counter=1
start=0
now=sigma[start]
while start!=now:
    now=sigma[now]
    counter+=1
    
if N==counter:
    f=1
    for i in range(N-1):
        if BSort[i]>=ASort[i+1]:
            f=0
            break

if f==0 and g==0:
    print("Yes")
else:
    print("No")
N = int(input())

point = []
dist = []

for _ in range(N) :
    x, y = map(int, input().split())
    point.append((x, y))
    dist.append(abs(x) + abs(y))

maxDist = dist[0]
mask = maxDist % 2

for i in range(1, N) :
    if dist[i] % 2 != mask :
        break
    maxDist = max(maxDist, dist[i])
else :  # 実現可能
    print(maxDist) # 腕の数
    out = [1] * maxDist
    print(*out)

    for i, (x, y) in enumerate(point) :
        if x < 0 :
            holizon = ['L'] * abs(x)
        elif x > 0 :
            holizon = ['R'] * abs(x)
        else :
            holizon = ['']

        if y < 0 :
            vertical = ['D'] * abs(y)
        elif y > 0 :
            vertical = ['U'] * abs(y)
        else :
            vertical = ['']

        R = (maxDist - dist[i]) // 2
        if R > 0 :
            last = ['LR'] * R
        else :
            last = ['']
        print(''.join(holizon + vertical + last))



### FIXED CODE ###

N=int(input())

point = []
parity = {}
for _ in range(N) :
    x, y = map(int, input().split())
    point.append((x, y))
    parity[(x + y) % 2] = 1

if len(set(parity)) == 2 :
    print('-1')
else :
    m = 38
    parity = 1 if (1 in parity) else 0
    print(m + 1 - parity)
    if parity == 1 :  # 距離が奇数
        print(*[1 << i for i in range(m)])
    else :
        print(1, *[1 << i for i in range(m)])

    def arm(x, y, m) :
        if abs(x) >= abs(y) :
            if x >= 0 :
                return ('R', x - (1<<m), y)
            else :
                return ('L', x + (1<<m), y)
        else :
            if y >= 0 :
                return ('U', x, y - (1<<m))
            else :
                return ('D', x, y + (1<<m))

    for x, y in point :
        ans = []
        for i in range(m-1, -1, -1) :
            mode, x, y = arm(x, y, i)
            ans.append(mode)
        if parity == 0 :  # 偶数の場合一つ足す
            if x == 1 :
                ans.append('R')
            elif x == -1 :
                ans.append('L')
            elif y == 1 :
                ans.append('U')
            elif y == -1 :
                ans.append('D')
        print(''.join(ans[::-1]))
H,W = map(int,input().split())
h,w = map(int,input().split())
prin((H-h)*(W-w))

### FIXED CODE ###

H,W = map(int,input().split())
h,w = map(int,input().split())
print((H-h)*(W-w))
n, k = list(map(int, input().split()))
s = input()

def findmax(s,k):
    if len(s) == 1:
        return 1
    begin = s[0]
    l = [0]
    cur = 0
    for i in range(len(s)):
        if s[i]==begin:
            l[cur]+=1
        else:
            if begin == '0' : begin ='1'
            else: begin = '0'
            cur+=1
            l.append(1)
    r = 0
    if s[0] == '0':
        l = [0] + l
        r = 2*k
    else:
        r = 2*k+1
    sumup = [0]
    for i in range(len(l)):
        sumup.append(sumup[i]+l[i])
    return (max([sumup[i+r]-sumup[i] for i in range(len(sumup)-r)]))
print (findmax(s,k))

### FIXED CODE ###

from itertools import accumulate

n, k = list(map(int,input().split(" ")))
s = input()


def findmax():
    cur=0
    l=[]
    prev = '1'
    for c in s:
        if prev ==c:
            cur+=1
        else:
            l.append(cur)
            cur = 1
        prev=c
    l.append(cur)
    if prev=='0':
        l.append(0)
    w = 2*k+1
    if len(l)<=w:
        return n
    sumup = [0]+list(accumulate(l))
    res = 0
    for i in range(0, len(l)-w+1,2):
        res = max(res,sumup[i+w]-sumup[i])
    return res
print(findmax())
from functools import lru_cache


def popcnt(n):
    c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c >> 4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c >> 8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c >> 16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c >> 32) & 0x00000000ffffffff)
    return c


@lru_cache(maxsize=None)
def rec(n):
    if n == 0:
        return 0
    else:
        return rec(n % popcnt(n)) + 1


n = int(input())
arr = input()

li = []

for i in range(n):
    tmp = arr[:i] + str(1 ^ int(arr[i])) + arr[i + 1:]
    li.append(int(tmp, 2))

for x in li:
    print(rec(x))

### FIXED CODE ###

from functools import lru_cache


def popcnt(x):
    return bin(x).count("1")


@lru_cache(maxsize=None)
def rec(n):
    if n == 0:
        return 0
    else:
        return rec(n % popcnt(n)) + 1


ret = [rec(x) for x in range(2 * 10**5 + 1)]


n = int(input())
arr = input()

ALL_ARR = int(arr, 2)

cnt = popcnt(int(arr, 2))
init_big = ALL_ARR % (cnt + 1)
if cnt == 1:
    init_small = 0
else:
    init_small = ALL_ARR % (cnt - 1)


li = [0] * n
for i in range(n):
    if arr[i] == "0":
        li[i] = (init_big + pow(2, n - i - 1, cnt + 1)) % (cnt + 1)
    elif ALL_ARR - (1 << (n - i - 1)) == 0 or cnt - 1 == 0:
        li[i] = "flg"
    else:
        li[i] = (init_small - pow(2, n - i - 1, cnt - 1)) % (cnt - 1)


ans = []

for x in li:
    if x == "flg":
        ans.append(0)
    else:
        ans.append(ret[x] + 1)

print(*ans, sep="\n")
n,t = map(int, input().split( ))
t = tuple(map(int, input().split( )))
ans  = 0
ti = 0;
for i in range(n):
    if t[i] >= ti+t:
        ans += t 
    else:
        ans += t[i] - ti
    ti = t[i]
print(ans)
    


### FIXED CODE ###

n,tt = map(int, input().split( ))
t = tuple(map(int, input().split( )))
ans  = 0
ti = 0;
for i in range(n):
    if t[i] >= ti+tt:
        ans += tt 
    else:
        ans += t[i] - ti
    ti = t[i]
print(ans+tt)##最後の分
from collections import defaultdict

n = int(input())
dct = defaultdict(int)

for i in range(n):
    s = input()
    sorted_s = ''.join(sorted(s))
    dict[sorted_s] += 1

ans = 0
for a, b in dct.items():
    ans += b *(b-1)//2

print(ans)

### FIXED CODE ###

from collections import defaultdict

n = int(input())
dct = defaultdict(int)

for i in range(n):
    s = input()
    sorted_s = "".join(sorted(s))
    dct[sorted_s] += 1

ans = 0
for a, b in dct.items():
    ans += b *(b-1)//2

print(ans)
import numpy as np 
N,M=map(int, input().split())  
A=list(map(int, input().split()) 
suma=np.sum(A)
remain=N-suma       

if remain>=0:
    print(remain)
else:
    print(-1)

### FIXED CODE ###

import numpy as np

N,M=map(int, input().split())
A=list(map(int, input().split()))

suma=np.sum(A)
remain=N-suma

if remain>=0:
	print(remain)
else:
	print(-1)
from sys import exit
from itertools import accumulate
n=int(input())
s=[input() for i in range(n)]
t=[2*(i.count("("))-len(i) for i in s]
#pypyではinitialだめ
st=[[t[i],min(accumulate(s[i],lambda a,b: a+(1 if b=="(" else -1),initial=0))] for i in range(n)]

now2=sum(map(lambda x:x[0],filter(lambda x:x[1]>=0,st)))
v=list(filter(lambda x:x[1]<0 and x[0]>=0,st))
w=list(filter(lambda x:x[1]<0 and x[0]<0,st))
v.sort(reverse=True,key=lambda z:z[1])
w.sort(key=lambda z:z[0]-z[1],reverse=True)

for sub in chain(v,w):
    if now2+sub[1]<0:
        print("No");exit()
    now2+=sub[0]
print("Yes")

### FIXED CODE ###

import sys
n=int(input())
s=[input() for i in range(n)]
t=[2*(i.count("("))-len(i) for i in s]
if sum(t)!=0:
    print("No")
    sys.exit()
st=[[t[i]] for i in range(n)]

for i in range(n):
    now,mi=0,0
    for j in s[i]:
        if j=="(":
            now+=1
        else:
            now-=1
        mi=min(mi,now)
    st[i].append(mi)
#st.sort(reverse=True,key=lambda z:z[1])
u,v,w=list(filter(lambda x:x[1]>=0,st)),list(filter(lambda x:x[1]<0 and x[0]>=0,st)),list(filter(lambda x:x[1]<0 and x[0]<0,st))
v.sort(reverse=True)
v.sort(reverse=True,key=lambda z:z[1])
w.sort(key=lambda z:z[0]-z[1],reverse=True)
lu=len(u)
lv=len(v)
now2=0
for i in range(n):
    if i<lu:
        now2+=u[i][0]
    elif i<lu+lv:
        if now2+v[i-lu][1]<0:
            print("No")
            break
        now2+=v[i-lu][0]
    else:
        #いや、間違ってるのここなんかーーい
        if now2+w[i-lu-lv][1]<0:
            print("No")
            break
        now2+=w[i-lu-lv][0]
else:
    print("Yes")
import itertools

N,M=map(int,input().split())
if M==0:
    print(0)
    exit()
S=[list(map(int,input().split()))for _ in range(N) ]

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

L=list(itertools.permutations(a))


cnt=0

for l in L:
    tmp=1
    if l[0]!=1:
        break
    for j in range(N-1):
        if ([l[j],l[j+1]] in S) or ([l[j+1],l[j]] in S):
            tmp=1
        else:
            tmp=0
            break
    if tmp==1:
        cnt+=1

print(cnt)

### FIXED CODE ###

import itertools

N,M=map(int,input().split())
S=[list(map(int,input().split()))for _ in range(M) ]

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

L=list(itertools.permutations(a))


cnt=0

for l in L:
    tmp=1
    if l[0]!=1:
        break
    for j in range(N-1):
        if ([l[j],l[j+1]] in S) or ([l[j+1],l[j]] in S):
            tmp=1
        else:
            tmp=0
            break
    if tmp==1:
        cnt+=1

print(cnt)
A=int(input())
B=int(input())
ans=(A+B-1)//B
print(ans)


### FIXED CODE ###

A,B=map(int,input().split())
if B==1:
    ans=0
elif 1<B and B<=A:
    ans=1
else :
    for k in range(2,100):
        if (k-1)*A-(k-2)<B and B<=k*A-(k-1):
            ans=k
        else:
            k=k+1
print(ans)
i = 0
while True:
    x = input()
    if x == 0:
        return 0
    i += 1
    print("Case %d: %d" % (i, x))

### FIXED CODE ###

i = 0
while True:
    x = input()
    if x == 0:
        break
    i += 1
    print("Case %d: %d" % (i, x))
while True:
    (H, W) = [int(i) for i in input().split()]
    if H == W == 0:
        break

    for a in range(H):
        for b in range(w):
            print('#', end='')
        print()
    print()

### FIXED CODE ###

while True:
    (H, W) = [int(i) for i in input().split()]
    if H == W == 0:
        break
 
    [print('#' * W) if i == 0 or i == H - 1 else print('#'+'.'*(W-2)+'#')
            for i in range(H)]
    print()
import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


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


def readstrs():
    return input().split()


N, P = readnums()
A = map(lambda x: x % 2, readnums())

if not sum(A):
    print(0)
else:
    print(2 ** N // 2)


### FIXED CODE ###

import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


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


def readstrs():
    return input().split()


N, P = readnums()
A = map(lambda x: x % 2, readnums())

if P:
    if not sum(A):
        print(0)
    else:
        print(2 ** N // 2)
else:
    if not sum(A):
        print(2 ** N)
    else:
        print(2 ** N // 2)
def isInvalid(maze,i,j,dr,dc,visited):
    if i>dr or i<0 or j>dc or j<0:
        return True
    
    if visited[i][j]:
        return True
    
    if maze[i][j] == "#":
        return True
    
    return False

def grid(maze,i,j,dr,dc,visited):
    global count

    if i == dr and j == dc:
        count+=1
        
        return 
    
    if isInvalid(maze,i,j,dr,dc,visited):
        return
    visited[i][j] = True

    grid(maze,i,j+1,dr,dc,visited)
    grid(maze,i+1,j,dr,dc,visited)
    visited[i][j]= False

    



h,w = map(int,input().split())

maze = []

for _ in range(h):
    maze.append(list(input()))

count=0

visited = [[False]*w for _ in range(h)]
grid(maze,0,0,h-1,w-1,visited)
mod = 7+10**9
print(count%mod)


### FIXED CODE ###

def grid(maze,h,w):
    mod = 7+10**9
    visited = [[0]*w for _ in range(h)]
    for i in range(h):
        for j in range(w):
            if maze[i][j] == "#":
                continue

            if i==0 and j==0:
                visited[i][j] = 1
                
            
            elif i == 0:
                visited[i][j] = visited[i][j-1]
            elif j == 0:
                visited[i][j] = visited[i-1][j]
            else:
                visited[i][j] = (visited[i-1][j]%mod + visited[i][j-1]%mod)%mod
    
    return visited[h-1][w-1]


h,w = map(int,input().split())

maze = []

for _ in range(h):
    maze.append(list(input()))

print(grid(maze,h,w))
li = input().split()
c = 0
for i in range(0,3):
  if li[i]=='1':
    c++
    
print(c)

### FIXED CODE ###

li = list(input())
c = 0
for i in [0,1,2]:
  if li[i]=='1':
    c = c +1
    
print(c)
def main():
    S = input()
    K = int(input())
    if S[0] == "1":
        if K == 1:
            return 1
        else:
            i = 0
            while S[i] == "1":
                i += 1
            return  int(S[i])
    else:
        return int(S[0])


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


### FIXED CODE ###

def main():
    S = input()
    K = int(input())
    i = 0
    while i < len(S) and S[i] == "1":
        i += 1
    if K <= i:
        return "1"
    else:
        return S[i]

if __name__ == '__main__':
    print(main())
# coding: utf-8
def II(): return int(input())
def ILI(): return list(map(int, input().split()))


def read():
    N = II()
    return (N,)


def solve(N):
    ans = []
    for h in range(1, 3501):
        flag = False
        for n in range(1, 3501):
            w = (N * h * n) / (4 * h * n - N * h - N * n)
            if w > 0 and int(w) == w:
                ans = [h, n, w]
                flag = True
                break
        if flag:
            break
    ans = " ".join(map(str, map(int, ans)))
    return ans


def main():
    params = read()
    print(solve(*params))


if __name__ == "__main__":
    main()


### FIXED CODE ###

# coding: utf-8
def II(): return int(input())
def ILI(): return list(map(int, input().split()))


def read():
    N = II()
    return (N,)


def solve(N):
    ans = []
    for h in range(1, 3501):
        flag = False
        for n in range(1, 3501):
            if 4 * h * n - N * h - N * n == 0:
                continue
            div, mod = divmod(N * h * n, 4 * h * n - N * h - N * n)
            if mod == 0 and div > 0:
                ans = [h, n, div]
                flag = True
                break
        if flag:
            break
    ans = " ".join(map(str, ans))
    return ans


def main():
    params = read()
    print(solve(*params))


if __name__ == "__main__":
    main()
N = input()

org_sum = 1/2*N*(N+1)
div3 = N // 3
div5 = N // 5
div15 = N // 15

return org_sum - div3 - div5 + div15

### FIXED CODE ###

N = int(input())
 
org_sum = 1 * N * (N+1) // 2
div3 = N // 3
sum3 = 3 * div3 * (div3+1) //2
div5 = N // 5
sum5 = 5 * div5 * (div5+1) // 2
div15 = N // 15
sum15 = 15 * div15 * (div15+1) // 2
 
print(org_sum - sum3 - sum5 + sum15)