Harryxun/stf_run huggingface dataset:
x, n = [int(x) for x in input().split()]

if n = 0:
    print(x)
    exit()

P = [int(x) for x in input().split()]

before = x
after = x
while True:
    if before not in P:
        print(before)
        break
    elif after not in P:
        print(after)
        break
    before -= 1
    after += 1


### FIXED CODE ###

x, n = [int(x) for x in input().split()]

if n == 0:
    print(x)
    exit()

P = [int(x) for x in input().split()]

before = x
after = x
while True:
    if before not in P:
        print(before)
        break
    elif after not in P:
        print(after)
        break
    before -= 1
    after += 1
n,k=map(int,input().split())
a=list(map(int,input().split()))
tmp=min(a)
count_min=Counter(a)[tmp]
kazu=n-count_min
if kazu%(k-1)==0:
    print(kazu//(k-1))
else:
    print(kazu//(k-1)+1)

### FIXED CODE ###

from collections import Counter
n,k=map(int,input().split())
a=list(map(int,input().split()))
tmp=min(a)
count_min=Counter(a)[tmp]
kazu=n-count_min
if kazu%(k-1)==0:
    print(kazu//(k-1))
else:
    print(kazu//(k-1)+1)
import math
N,M=int(input())
def combination(n,r):
    return math.factrial(n)//math.factrial(n-r)*math.factrial(r)
print(combination(N,M))

### FIXED CODE ###

N,M=map(int,input().split())
print(N*(N-1)//2+M*(M-1)//2)
##149
##A
S = input()
T = input()

print(T+S)

### FIXED CODE ###

##149
##A
S,T = map(str,input().split())

print(T+S)
alphabet = 'abcdefghijklmnopqrstuvwxyz'
from collections import defaultdict

adict = defaultdict(int)

while True:
    str = ''
    str = input().lower()
    if len(str) == 0:
        break
    for c in str:
        adict[c] += 1

for k in alphabet:
    print('%s : %i' %(k, adict[k]))

### FIXED CODE ###

alphabet = 'abcdefghijklmnopqrstuvwxyz'
from collections import defaultdict
import sys

adict = defaultdict(int)

for l in sys.stdin:
    for c in l.lower():
        adict[c] += 1
        
for k in alphabet:
    print('%s : %i' %(k, adict[k]))
n = input()
if n % 2 ==0:
    print(n)
else:
    print(n*2)

### FIXED CODE ###

n = int(input())
if n % 2 ==0:
    print(n)
else:
    print(n*2)
n=int(input())
g=lambda x:(x*(n//x)*(n//x+1))//2
print(sum(g(i) for i in range(2,n+2)-sum(g(i) for i in range(1,n+1)))

### FIXED CODE ###

def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table
n=int(input())
print(sum(num_divisors_table(n-1)))
s=input()
o=s.count('o')

print o*800+(len(s)-o)*700

### FIXED CODE ###

s=input()
o=s.count('o')
print(700+100*o)
w,h,x,y=map(int,input().split())

ans1=w*h/2
if w/x==2 and h/y==2:
    a=1
else:
    a=0
print(ans1,a)


### FIXED CODE ###

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

ans1=w*h/2
if w/2==x and h/2==y:
    a=1
else:
    a=0
print(ans1,a)
if S<=W:
  print("unsafe")
else:
  print("safe")

### FIXED CODE ###

(S,W)=input().split()
S=int(S)
W=int(W)
if S<=W:
  print("unsafe")
else:
  print("safe")
N = input()

result = False
count = 0

for range(N):
    D1,D2 = map(int,input().split())
    if D1 == D2:
        count += 1
    else:
        count = 0

    if count > 2:
        result = True
        break

if result:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

N = int(input())

result = False
count = 0

for i in range(N):
    D1,D2 = map(int,input().split())
    if D1 == D2:
        count += 1
    else:
        count = 0

    if count > 2:
        result = True
        break

if result:
    print('Yes')
else:
    print('No')
from collections import deque


def bfs(S):  # 幅優先探索  # キュー
    dist = [-1] * (w + h)
    que, frag = deque(), set()
    for i, Si in enumerate(S):
        for j, Sij in enumerate(Si):
            if Sij == '#':
                dist[i + (h * j)] = 0
                que.append((i, j)), frag.add((i, j))

    while len(que) > 0:
        (x, y) = que.popleft()
        near = [(x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)]
        for i, j in near:  # 移動先の候補
            if (i, j) in frag:  # 処理済みか否か
                continue
            if 0 <= i < h and 0 <= j < w:
                dist[i + (h * j)] = dist[i + (h * j)] + 1
                que.append((i, j)), frag.add((i, j))
    return dist


h, w = map(int, input().split())
a = [input() for _ in range(h)]
ans = bfs(a)
print(max(max(ansi) for ansi in ans))


### FIXED CODE ###

from collections import deque


def bfs(S):  # 幅優先探索  # キュー
    dist = [[-1] * w for _ in range(h)]  # 前処理
    que = deque()
    for i, Si in enumerate(S):
        for j, Sij in enumerate(Si):
            if Sij == '#':
                dist[i][j] = 0
                que.append((i, j))

    while len(que) > 0:
        (x, y) = que.popleft()
        near = [(x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)]
        for i, j in near:  # 移動先の候補
            if 0 <= i < h and 0 <= j < w and dist[i][j] < 0:
                dist[i][j] = dist[x][y] + 1
                que.append((i, j))
    return dist[x][y]


h, w = map(int, input().split())
a = [input() for _ in range(h)]
print(bfs(a))
import bisect
n,m = [int(i) for i in input().split()]
al = sorted([int(i) for i in input().split()])
total = sum(al)

idx = bisect.bisect_left(al,total/(4*m))
idx = bisect.bisect_left(al,789)

if n - idx > m:
    print('Yes')
elif al[idx+1] == total/(4*m):
    print('No')
else:
    print('No')


### FIXED CODE ###

import bisect
n,m = [int(i) for i in input().split()]
al = sorted([int(i) for i in input().split()],reverse = True)
total = sum(al)

l = al[:m]

if l[-1] >= total/(4*m):
    print('Yes')
else:
    print('No')
import bisect

n,k=map(int,input().split())
A=list(map(int,input().split()))
A.sort()

left=-10**18
right=10**18
count=0

a=bisect.bisect_left(A,0)
b=bisect.bisect_right(A,0)

if n*(n-1)-b*(n-a)-(b-a)>=2*k:
    right=0
else:
    left=1

while right!=left:
    pos=(left+right)//2
    count=0
    for a in A:
        if a==0 and pos>=0:
            count+=n-1
        elif a<0:
            i=bisect.bisect_right(A,(-1-pos)//(-a))
            count+=n-i + (-1 if a*a<=pos else 0)
        else:
            i=bisect.bisect_right(A,pos//a)
            count+=i + (-1 if a*a<=pos else 0)
    if count>=2*k:
        right=pos
    else:
        left=pos+1

print(left)


### FIXED CODE ###

import numpy as np

n,k=map(int,input().split())
A=np.array(input().split(),np.int64)
A.sort()

zero=A[A==0]
neg=A[A<0]
pos=A[A>0]

def f(x): # count pairs x or less
    cnt=0
    #zero
    if x>=0:
        cnt += len(zero)*n
    #pos
    cnt += A.searchsorted(x//pos,side="right").sum()
    #neg
    cnt += (n-A.searchsorted(-(-x//neg),side="left")).sum()
    #except a*a
    cnt-=np.count_nonzero(A*A<=x)
    return cnt//2

l=-10**18
r=10**18

while l<r:
    pov=(l+r)//2
    if f(pov)>=k:
        r=pov
    else:
        l=pov+1
print(l)
X=int(input())
  print (int(X**0.5))

### FIXED CODE ###

N = int(input())
print(int(N**0.5)**2)
N, K = map(int, input().split())
S = input()
S[K] = str.lower(S[k])
print(S)

### FIXED CODE ###

N, K = map(int, input().split())
S = input()
print(S[0:K-1] + S[K-1].lower() + S[K:])
N = input()

ans = 0
for i in N:
    ans += int(i)

if N % ans ==0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N = input()

ans = 0
for i in N:
    ans += int(i)

if int(N) % ans ==0:
    print("Yes")
else:
    print("No")
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    Sn = sum(list(str(n)))
    print('Yes' if n % Sn == 0 else 'No')


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    Sn = sum(list(map(int, list(str(n)))))
    print('Yes' if n % Sn == 0 else 'No')


if __name__ == '__main__':
    main()
c = []
for i in range(3):
    c.append([int(c) for c in input().split(' ')])
result = 'No'
for a1 in range(0, 101):
    for a2 in range(0, 101):
        for a3 in range(0, 101):
            if ((a1 - a2 == c[0][0]+c[0][1]+c[0][2]
            - c[1][0]- c[1][1] - c[1][2])
             and (a1-a3 == c[0][0]+c[0][1]+c[0][2]
             -c[2][0]- c[2][1] - c[2][2])
             and (a2 - a3 == c[1][0]+ c[1][1] + c[1][2]
             - c[2][0] - c[2][1] - c[2][2]
             )):
                result = 'Yes'
                break
print(result)

### FIXED CODE ###

n = int(input())
a = int(input())

rest = n % 500
if rest <= a :
    print('Yes')
else:
    print('No')
#https://atcoder.jp/contests/dp/tasks/dp_i
import math
N = int(input())
P_List = list(map(float,input().split()))
dp = [[] * N for i in range(N+1)]
std = math.ceil(N/2)
for i in range(N+1):
    if i == 0:
        dp[0].append(1)
    else:
        Current_P = P_List[i - 1]
        for j in range(i + 1):
            if (N - i + j) < std:
                dp[i].append(0)
            elif j == 0:
                dp[i].append(dp[i - 1][j]*(1 - Current_P),10)
            elif j != i:
                dp[i].append((dp[i - 1][j]*(1 - Current_P)) + (dp[i - 1][j - 1]*Current_P),10)
            else:
                dp[i].append(dp[i - 1][j - 1]*Current_P,10)
    
print(sum(dp[N]))


### FIXED CODE ###

#https://atcoder.jp/contests/dp/tasks/dp_i
import math
N = int(input())
P_List = list(map(float,input().split()))
dp = [[0 for j in range(N + 1)] for i in range(N+1)]
std = math.ceil(N/2)
for i in range(N+1):
    if i == 0:
        dp[i][0] = 1
    else:
        Current_P = P_List[i - 1]
        for j in range(i + 1):
            if (N - i + j) < std:
                dp[i][j] = 0
            elif j == 0:
                dp[i][j] = dp[i - 1][j]*(1 - Current_P)
            elif j != i:
                dp[i][j] = (dp[i - 1][j]*(1 - Current_P)) + (dp[i - 1][j - 1]*Current_P)
            else:
                dp[i][j] = dp[i - 1][j - 1]*Current_P
    
print(sum(dp[N][math.ceil(std):]))
ta_c,ao_c,num = map(int,input().split())

if num <= ta_c:
    print(ta_o-num,ao_c):
elif ta_c < num <= ta_c + ao_c:
    ao_c = ta_c+ao_c - num
    ta_c = 0
    print(ta_c,ao_c)
else;
    ta_c, ao_c = 0,0
    print(ta_c,ao_c)

### FIXED CODE ###

ta_c,ao_c,num = map(int,input().split())

if num <= ta_c:
    print(ta_c-num,ao_c)
elif ta_c < num <= ta_c + ao_c:
    ao_c = ta_c+ao_c - num
    ta_c = 0
    print(ta_c,ao_c)
else:
    ta_c, ao_c = 0,0
    print(ta_c,ao_c)
l = list(map(int, input().split()))
print("ABC"+l[0])

### FIXED CODE ###

S = input()
print("ABC"+S)
import math
a,b,c,d = map(int,input().split())
lcm = c*d // math.gcd(c,d)
A = ((a-1) // c) + ((a-1) // d) - ((a-1) // lcm)
B = (b // c) + (b // d) - (b // lcm)
total = B - A
print(b - a + 1 - total)

### FIXED CODE ###

a,b,c,d = map(int,input().split())
ans = b - a + 1
x = c * d
e = c
f = d
if e < f:
    e = f
    f = c
r = e % f
while r != 0:
    e = f
    f = r
    r = e % f
x //= f
ans -= b // c - (a-1) // c + b // d - (a-1) // d
ans += b // x - (a-1) // x
print(ans)
#ABC145D

MOD = 10 ** 9 + 7
import math
x,y = map(int,input().split())
a,b = -1,-1

for i in range(x+1):
    m = 0
    if (x-i) % 2 == 0:
        m = (x-i) // 2
        if 2*i + m == y:
            if i >= 0 and m >= 0:
                a = i
                b = m
                break
    else:
        continue
        
MAX_N = 10**6

fact = [1]
fact_inv = [0]*(MAX_N+4)
for i in range(MAX_N+3):
    fact.append(fact[-1]*(i+1)%MOD)

fact_inv[-1] = pow(fact[-1],mod-2,MOD)
for i in range(MAX_N+2,-1,-1):
    fact_inv[i] = fact_inv[i+1]*(i+1)%MOD

def com(n,k,mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n-k] %mod  
        
        
if a == -1 and b == -1:
    print(0)
else:
    print(com(a+b,a,MOD))

### FIXED CODE ###

#ABC145D

MOD = 10 ** 9 + 7
import math
x,y = map(int,input().split())
a,b = -1,-1

for i in range(x+1):
    m = 0
    if (x-i) % 2 == 0:
        m = (x-i) // 2
        if 2*i + m == y:
            if i >= 0 and m >= 0:
                a = i
                b = m
                break
    else:
        continue
        
MAX_N = 10**6

fact = [1]
fact_inv = [0]*(MAX_N+4)
for i in range(MAX_N+3):
    fact.append(fact[-1]*(i+1)%MOD)

fact_inv[-1] = pow(fact[-1],MOD-2,MOD)
for i in range(MAX_N+2,-1,-1):
    fact_inv[i] = fact_inv[i+1]*(i+1)%MOD

def com(n,k,mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n-k] %mod  
        
        
if a == -1 and b == -1:
    print(0)
else:
    print(com(a+b,a,MOD))
a = [int(input()) for i in range(N)]
flag = True

for i in range(N):
  if a[N-1] < a[i]:
    flag = False

if flag:
  print('Yay')
else:
  print(':(')

### FIXED CODE ###

a = [int(input()) for i in range(6)]
flag = True

for i in range(6):
  for j in range(i+1, 6):
    if abs(a[i] - a[j]) > a[5]:
      flag = False

if flag:
  print('Yay!')
else:
  print(':(')
import sys
input=sys.stdin.readline

input = open(sys.argv[1],"r").readline

def main():
    N,K = map(int, input().split())
    X = list(map(int, input().split()))
    ans = 3*10**8
    for i in range(0,N-K+1):
        l = X[i]
        r = X[i+K-1]
        if l*r < 0:
            ans = min(ans, 2*min(abs(l),abs(r)) + max(abs(l),abs(r)))
        else:
            ans = min(ans, max(abs(l),abs(r)))

    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input=sys.stdin.readline

def main():
    N,K = map(int, input().split())
    X = list(map(int, input().split()))
    ans = 3*10**8
    for i in range(0,N-K+1):
        l = X[i]
        r = X[i+K-1]
        if l*r < 0:
            ans = min(ans, 2*min(abs(l),abs(r)) + max(abs(l),abs(r)))
        else:
            ans = min(ans, max(abs(l),abs(r)))

    print(ans)

if __name__ == '__main__':
    main()
N, M = map(int, input().split())

gr = set()

for i in range(N):
    a, b = map(int, input().split())
    gr |= {(a-1,b-1),(b-1,a-1)}

from itertools import permutations

ans = 0
for p in permutations(range(N)):
    if p[0]==0:
        cnt = 0
        cntp = 0
        for i in range(N-1):
            cnt += 1
            if (p[i],p[i+1]) in gr:
                cntp += 1
            else:
                break
        if cnt == cntp:
            ans += 1
print(ans)

### FIXED CODE ###

from itertools import permutations

N, M = map(int, input().split())
gr = set()

for i in range(M):
    a, b = map(int, input().split())
    gr |= {(a-1,b-1),(b-1,a-1)}

ans = 0
for p in permutations(range(N)):
    if p[0]==0:
        cnt = 0
        cntp = 0
        for i in range(N-1):
            cnt += 1
            if (p[i],p[i+1]) in gr:
                cntp += 1
            else:
                break
        if cnt == cntp:
            ans += 1
print(ans)
s=input()
res=0
for i in range(len(s)):
    for j in range(i+1,len(s)):
        if set(list(s[i:j]))|{'A','G','C','T'}=={'A','G','C','T'}:
            cnt=len(s[i:j])
        if res<cnt:
            res=cnt

print(res)

### FIXED CODE ###

s=input()

res=0
for i in range(len(s)+1):
    for j in range(i+1,len(s)+1):
        cnt=0
        for x in s[i:j]:
            if x not in ['A','G','C','T']:
                break
            cnt+=1
        if res<cnt:
            res=cnt

print(res)
n = int(input())
a = [int(input()) for i in range(n)]
check = [0 for i in range(n)]
now = 0
ans = 0
while check[now] == 0:
    if now == 1:
        print(ans)
        break
    check[now] = 1
    now = a[now-1]
    ans += 1
else:
    print(-1)

### FIXED CODE ###

n = int(input())
a = [int(input()) for i in range(n)]
check = [0 for i in range(n)]
now = 1
ans = 0
while check[now-1] == 0:
    if now == 2:
        print(ans)
        break
    check[now-1] = 1
    now = a[now-1]
    ans += 1
else:
    print(-1)
def rootedTrees(node,parent,depth,name,root):
    A.append([node,parent,depth,name,root])
    for i in root:
        if len(Tree[i])!=0:
            rootedTrees(i,node,depth+1,"internal node",Tree[i])
        else:
            rootedTrees(i,node,depth+1,"leaf",Tree[i])


n=int(input())
color=[0]*(n+1)
Tree=[[] for _ in range(n+1)]
for i in range(n-1):
    a,b=map(int,input().split())
    Tree[a].append(b)
Tree[0] +=[1]

A=[]
rootedTrees(0,-1,0,"root",Tree[0])

for node,parent,depth,name,root in A:
    cnt=0
    if node==0:continue
    for i,j in enumerate(root):
        if color[node]==i:
            cnt +=1
        color[j]=i+cnt

print(max(color)+1)
for i in range(2,n+1):
    print(color[i]+1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)


def rootedTree(node,parent,root,add):
    A.append([node,parent,root,add])
    for root_num,num in root:
        if len(tree[root_num])!=0:
            rootedTree(root_num,node,tree[root_num],num)
        else:
            A.append([root_num,node,tree[root_num],num])


n=int(input())
AB=[list(map(int,input().split()))+[i+1] for i in range(n-1)]
A=[]
tree=[[] for i in range(n+1)]
for a,b,c in AB:
    tree[a] +=[[b,c]]

rootedTree(1,0,tree[1],0)
ans=[0]*n
for node,parent,root,num in A:
    flag=0
    for i,j in enumerate(root):
        if ans[num]==i+1:flag=1
        if flag:
            ans[j[1]]=i+2
            continue
        ans[j[1]]=i+1

print(max(ans))
for i in range(1,n):print(ans[i])
list = []
x = 0
y = 0
n = int(input())
for i in range(n):
    a,b = map(int,input().split())
    list.append(a)
    list.append(b)
for _ in range(n):
    if not list[x-1] == list[-1]:
        if list[x] == list[x+1]:
            if not list[x+1] == list[-1]:
                if list[x+2] == list[x+3]:
                    if not list[x+3] == list[-1]:
                        if list[x+4] == list[x+5]:
                            y = 1
    x = x + 2
if y == 0:
    print('No')
else:
    print('Yes')

### FIXED CODE ###

n = input()
a = 's'
b = 'es'
if n[-1] == 's':
    n = n + b
else:
    n = n + a
print(n)
n = int(input())
a = [int(input()) for _ in range(n)]

c = 1
for i in range(n):
  if c == 2:
    print(i + 1)
    exit(0)
  c = a[c]
print(-1)

### FIXED CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]

c = 1
for i in range(n):
  c = a[c - 1]
  if c == 2:
    print(i + 1)
    exit(0)

print(-1)
a,b,c,d = map(int, input().split())
print(min(a,b) + min(c,d))

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
print(min(a,b) + min(c,d))
a,b = map(int,input().split())
lst = list(range(a,b+1))

if a > 0 and b > 0:
    print("Positive")
elif a <= 0 and b >= 0:
    print("Zero")
elif a < 0 and b < 0:
    if ((b-a)-1) % 2  != 0:
        print("Negative")
    else:
        print("Positive")

### FIXED CODE ###

a,b = map(int,input().split())

if a > 0 and b > 0:
    print("Positive")
elif a <= 0 and b >= 0:
    print("Zero")
elif a < 0 and b < 0:
    if ((b-a)-1) % 2  != 0:
        print("Negative")
    else:
        print("Positive")
input_list = input().split()
input_list2 = list(map(input().split()))
delete_ball = input()
for ind, n in enumerate(input_list):
  if n == delete_ball:
    input_list2[ind] -= 1
print(input_list2)

### FIXED CODE ###

input_list = input().split()
input_list2 = list(map(int, input().split()))
delete_ball = input()
for ind, n in enumerate(input_list):
  if n == delete_ball:
    input_list2[ind] -= 1
ans = ""
for m in input_list2:
  ans += str(m) + " "
print(ans.rstrip())
# N = number of people
# M = number of foods

N, M = map(int, raw_input().split())

result = [0]*M

for i in range(N):
  foods = map(int,raw_input().split())
  pers_count = foods.pop(0)
  
  for f in foods:
    results[f-1] += 1

res_count = 0
for r in results:
  if M == r:
    res_count += 1
print res_count

### FIXED CODE ###

N, M = map(int, raw_input().split())

result = [0]*M

for i in range(N):
  foods = map(int, raw_input().split())
  pers_count = foods.pop(0)
  
  for f in foods:
    result[f-1] += 1

res_count = 0
for r in result:
  if N == r:
    res_count += 1

print res_count
import math
from functools import reduce

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

P = 10**9 + 7
N = 10000
inv_t = [0]+[1]
for i in range(2,N):
    inv_t += [inv_t[P % i] * (P - int(P / i)) % P]

n=int(input())
A=[int(i) for i in input().split()]

#kyodai=lcm_list(A)
kyodai=A[0]
for i in range(1,n):
    kyodai=lcm_base(kyodai,A[i])

ans=0

for i in range(n):
    ans+=kyodai*inv_t[A[i]]
    ans=ans%P

print(ans)

### FIXED CODE ###

def gcd(a,b):
    for xx in range(1000001):
        a,b=b,a%b
        if b==0:
            break
    return a

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

P = 10**9 + 7
N = 1000001
inv_t = [0]+[1]
for i in range(2,N):
    inv_t += [inv_t[P % i] * (P - int(P / i)) % P]

n=int(input())
A=[int(i) for i in input().split()]

#kyodai=lcm_list(A)
kyodai=A[0]
for i in range(1,n):
    kyodai=lcm_base(kyodai,A[i])

ans=0

for i in range(n):
    ans+=inv_t[A[i]]
    ans=ans%P
ans=ans*kyodai
ans=ans%P

print(ans)
n, m, k = map(int, input().split())
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
SA = sum(A)
SB = sum(B)

if SA+SB <= k:
    print(len(A) + len(B))
else:
    t = 0
    ai = 0; bi = 0
    while True:
        if bi == m or A[ai] < B[bi]:
            t += A[ai]
            ai += 1
        else:
            t += B[bi]
            bi += 1

        if t >= k:
            break
    print(ai + bi - 1)
    

### FIXED CODE ###

n, m, k = map(int, input().split())
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
from itertools import accumulate
AS = [0] + list(accumulate(A))
BS = [0] + list(accumulate(B))

ans = 0
j = m
for i in range(n+1):
    if AS[i] > k:
        break

    while AS[i] + BS[j] > k:
        j -= 1
    ans = max(ans, i+j)
        
print(ans)
string = input()
# print(string)
# string = string[0]
# num = int(string[1])

num = int(input())
# num = int(l[1])
# print(string)
if num == 0:
    out = string
    print(out)
else:
    out=string[0]
    for i in [i for i in range(len(string))]:
        if i != 0:
            if i%num == 0:
                out=out+string[i]
    print(out)


### FIXED CODE ###

l = input().split()
if int(l[0])+int(l[1])==15:
    print('+')
elif int(l[0])*int(l[1]) ==15:
    print('*')
else:
    print('x')
N, M, X = map(int, input().split())
Ca = [list(map(int, input().split())) for _ in range(N)]
pattern = []
for i in range(2**N):
    lis = []
    for j in range(N):
        if ((i>>j)&1):
            lis.append(Ca[j])
    pattern.append(lis)

cnt = []
for i in range(2**N):
    g = [0] * (M+1)
    for j in range(len(pattern[i])):
        for k in range(M+1):
            g[k] += pattern[i][j][k]
    if g[1]<X or g[2]<X or g[3]<X:
        continue
    else:
        cnt.append(g[0])
if len(cnt) ==0:
    print(-1)
else:
    print(min(cnt))

### FIXED CODE ###

N, M, X = map(int, input().split())
Ca = [list(map(int, input().split())) for _ in range(N)]
pattern = []
for i in range(2**N):
    lis = []
    for j in range(N):
        if ((i>>j)&1):
            lis.append(Ca[j])
    pattern.append(lis)

cnt = []
for i in range(2**N):
    g = [0] * (M+1)
    for j in range(len(pattern[i])):
        for k in range(M+1):
            g[k] += pattern[i][j][k]
    if M==1 and g[1]< X:
        continue
    elif M>1 and min(g[1:M+1]) < X:
        continue
    else:
        cnt.append(g[0])
if len(cnt) ==0:
    print(-1)
else:
    print(min(cnt))
#奇数のとき、xとy足して奇数になる点にしか止まれない。偶数の時も同じ
#xとyの和がステップ数より多いとき、たどり着けない
N = int(input())
for i in range(N)
  t, x, y = map(int, input().split())
  wa = x+y
  if t < wa:
    print('No')
    exit()
  if t%2 == 0 and wa%2 != 0:
    print('No')
    exit()
  if t%2 == 1 and wa%2 != 1:
    print('No')
    exit()
print('Yes')

### FIXED CODE ###

n=int(input())
x=0
y=0
t=0
fl=True
for i in range(n):
  nt,nx,ny=map(int,input().split())
  dist=abs(x-nx)+abs(y-ny)
  if (nt-t)%2!=dist%2 or (nt-t)<dist:
    print("No")
    break
  x,y=nx,ny
  t=nt
else:
  print("Yes")