Harryxun/stf_run huggingface dataset:
def hantei(l):
    if l >= 1.1:
        return 'A'
    elif 0.6 <= l < 1.1:
        return 'B'
    elif 0.2 <= l < 0.6:
        return 'C'
    elif 0.2 < l:
        return 'D'

ldic = {'A':0, 'B':0, 'C':0, 'D':0}
rdic = {'A':0, 'B':0, 'C':0, 'D':0}
ls = []
while True:
    try:
        l,r = map(float,raw_input().split())
        ls.append((l,r))
    except EOFError:
        break
for l,r in ls:
    ldic[hantei(l)] += 1
    rdic[hantei(r)] += 1
    
for L,R in zip(sorted(ldic),sorted(rdic)):
    print L,R 

### FIXED CODE ###

def hantei(l):
    if l >= 1.1:
        return 'A'
    elif 0.6 <= l < 1.1:
        return 'B'
    elif 0.2 <= l < 0.6:
        return 'C'
    elif l  < 0.2 :
        return 'D'

ldic = {'A':0, 'B':0, 'C':0, 'D':0}
rdic = {'A':0, 'B':0, 'C':0, 'D':0}
ls = []
while True:
    try:
        l,r = map(float,raw_input().split())
        ls.append((l,r))
    except EOFError:
        break
        
for i,j in ls:
    ldic[hantei(i)] += 1
    rdic[hantei(j)] += 1
    
for L,R in zip(sorted(ldic),sorted(rdic)):
    print ldic[L],rdic[R]
N = int(input())
K = int(input())
l = [int(input()) for i in range(N)]
zero_kyori = 0
K_kyori = 0
kyori_list = []

for i in range(N):
    zero_kyori = l[i] - 0
    K_kyori = abs(l[i] - 0)
    kyori_list.append(min(zero_kyori, K_kyori))

print(sum(kyori_list))


### FIXED CODE ###

N = int(input())
K = int(input())
l = [int(i) for i in input().split()]
zero_kyori = 0
K_kyori = 0
kyori_list = []

for i in range(N):
    zero_kyori = (l[i] - 0) * 2
    K_kyori = (abs(l[i] - K)) * 2
    kyori_list.append(min(zero_kyori, K_kyori))

print(sum(kyori_list))
import numpy as np

N, W = map(int, input().split())

dp = np.zeros(W+1, dtype=np.int64)

for i in range(N):
    w, v = map(int, input().split())
    dp[w:] = np.maximum(dp[w:], dp[:-w]+v)
print(dp[-1])
    


### FIXED CODE ###

import numpy as np

N, W = map(int, input().split())
a = [list(map(int,input().split())) for _ in range(N)]
vmax = sum([a[i][1] for i in range(N)])
INF = float('inf')
dp = np.full(vmax+1, INF)
dp[0] = 0

for i in range(N):
  w, v = a[i-1]
  dp[v:] = np.minimum(dp[v:], dp[:-v]+w)
print(max([i for i in range(vmax+1) if dp[i] <= W]))
# input
s = input()

ans = ''

for i in range(len(s) // 2 + 1):
    ans = ans + s[2 * i]

print(ans)

### FIXED CODE ###

import math

# input
s = input()

ans = ''

for i in range(math.ceil(len(s) / 2)):
    ans = ans + s[2 * i]

print(ans)
n = int(input())
a = list(map(int, input().split()))
i = 0
ans = 1
if 0 in a:
    print(0)
else:
    while ans<10**18:
        ans*=a[i]
        i+=1
    if ans<=10**18:
        print(ans)
    else:
        print(-1)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
i = 0
ans = 1
if 0 in a:
    print(0)
else:
    while ans<10**18 and i < len(a):
        ans*=a[i]
        i+=1
    if ans<=10**18:
        print(ans)
    else:
        print(-1)
N,X,T=map(int,input(),split())
print((N//X+1)*T)

### FIXED CODE ###

n,x,t=map(int,input().split())
if n%x==0:
  print(n//x*t)
else:
  print((n//x+1)*t)
def prepare(n,arr):
    nodeArr = [[] for i in range(n)]
    for ar in arr:
        nodeArr[ar[0]-1].append([ar[1]-1,ar[2]])
        nodeArr[ar[1]-1].append([ar[0]-1,ar[2]])
    return nodeArr

def dfs(parent,currentNode,distance):
    if len(nodeArr) == 0:
        return

    if len(nodeArr[currentNode]) == 1:
        if currentNode != 0:
            # 末点
            res[currentNode] = distance
            return

    for next in nodeArr[currentNode]:
        nextNode = next[0]
        nextNodeDistance = next[1]
        if nextNode == parent:
            continue
        dfs(currentNode,nextNode,distance + nextNodeDistance)
    res[currentNode] = distance


n = int(input())

arr = []

for i in range(n-1):
    arr.append([int(s) for s in input().split(" ")])

nodeArr = prepare(n, arr)


if n == 1:
    print(1)
else:
    res = [-1 for i in range(n)]

    dfs(-1,0,0)

    result = [(re % 2) for re in res]

    for re in res:
        print(re % 2)



### FIXED CODE ###

import sys
sys.setrecursionlimit(20000000)
def prepare(n,arr):
    nodeArr = [[] for i in range(n)]
    for ar in arr:
        nodeArr[ar[0]-1].append([ar[1]-1,ar[2]])
        nodeArr[ar[1]-1].append([ar[0]-1,ar[2]])
    return nodeArr

def dfs(currentNode,distance):
    res[currentNode] = distance
    for next in nodeArr[currentNode]:
        nextNode = next[0]
        nextNodeDistance = next[1]
        if res[nextNode] == -1:
            dfs(nextNode,distance + nextNodeDistance)




n = int(input())

arr = []

for i in range(n-1):
    arr.append([int(s) for s in input().split(" ")])

nodeArr = prepare(n, arr)


if n == 1:
    print(1)
else:
    res = [-1 for i in range(n)]

    dfs(0,0)

    result = [(re % 2) for re in res]

    for re in res:
        print(re % 2)
n = int(input())
a= list(map(int,input().split()))
c = 1
if 0 in a:
    print(0)
else:
    for x in a:
        if x >10**18:
            print(-1)
            break
        else:
            c*=x
            if c >10**18:
                print(-1)
                break
    else:
        print(z)

### FIXED CODE ###

n = int(input())
a= list(map(int,input().split()))
c = 1
if 0 in a:
    print(0)
else:
    for x in a:
        if x >10**18:
            print(-1)
            break
        else:
            z = x*c
            c = z
            if z >10**18:
                print(-1)
                break
    else:
        print(z)
S = input()
if S == "ABC":
    print(ARC)
else:
    print(ABC)

### FIXED CODE ###

S = input()
if S == "ABC":
    print('ARC')
else:
    print('ABC')
N=int(input())
a=[int(input() ) for i in range(N)]
for i in range(N-1):
  if a[i]==a[i+1]:
    print("NO")
    exit(0)
print("YES")

### FIXED CODE ###

N=int(input())
a=list(map(int,input().split()))
a.sort()
for i in range(N-1):
  if a[i]==a[i+1]:
    print("NO")
    exit(0)
print("YES")
def main():
    n, m = map(int, input().split())
    mat = [[0]*n for i in range(n)]
    l = [list(map(int, input().split())) for _ in range(m)]

    for i in range(n):
        mat[l[i][0]-1][l[i][1]-1] = 1
        mat[l[i][1]-1][l[i][0]-1] = 1

    
    ver = [i for i in range(n)]

    cnt = 0

    def dfc(now, moved):
        
        nonlocal cnt

        moved.sort()
        if moved == ver:
            cnt += 1
        
        for i in range(n):
            if (mat[now][i] == 0) or (i in moved):
                continue
            
            dfc(i, moved + [i])

    dfc(0, [0])
    print(cnt)
    
if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():

    n, m = map(int, input().split())
    tree = [[]*n for i in range(n)]
    l = [list(map(int, input().split())) for _ in range(m)]
    
    for i in l:
        tree[i[0]-1].append(i[1]-1)
        tree[i[1]-1].append(i[0]-1)

    ver = [i for i in range(n)]

    cnt = 0

    def dfc(now, moved):
        
        nonlocal cnt
     
        moved.sort()
        if moved == ver:
            cnt += 1

        for i in tree[now]:
            if i in moved:
                continue
            dfc(i, moved + [i])

    dfc(0, [0])
    print(cnt)
    
if __name__ == "__main__":
    main()
x,y,a,b,c = map(int,input().split())

pl = list(map(int,input().split()))
ql = list(map(int,input().split()))
rl = list(map(int,input().split()))

pl = sorted(pl)
ql = sorted(ql)
rl = sorted(rl)
import itertools
pl_ac = [0] + list(itertools.accumulate(pl))
ql_ac = [0] + list(itertools.accumulate(ql))
rl_ac = [0] + list(itertools.accumulate(rl))

dada = max(ql, pl, rl)

import bisect
ans = 0
#　赤色をi個食べるとすると無職x-i
for i in range(x+1):
    tmp = 0
    if i > a or x - i > c or b + c - (x - i) < y:
        continue
    #あか
    tmp += pl_ac[-1] - pl_ac[-1-i]
    # #無職
    # tmp += rl_ac[-1] - ql_ac[-1-(x-i)]
    #残りの無職
    if x-i == 0:
        rl_c = rl[:] 
    else:
        rl_c = rl[:-(x-i)]
    # ub以上のりんご何個ある？
    ub = dada + 1

    lb = -1
    while True:
        if ub == lb:
            target = ub
            break
        target = (ub + lb) // 2 + 1
        idx = bisect.bisect_left(ql, target)
        idx2 = bisect.bisect_left(rl_c, target)
        if (b - idx) + (c - (x - i) - idx2) >= y:
            lb = target
        else:
            ub = target - 1
    idx = bisect.bisect_left(ql, target)
    idx2 = bisect.bisect_left(rl_c, target)
    tmp += ql_ac[-1] - ql_ac[idx]
    tmp += rl_ac[-1] - rl_ac[idx2]
    gg = (b - idx) + (c - (x - i) - idx2) - y
    ans -= target * gg
    ans = max(tmp, ans)

print(ans)

### FIXED CODE ###

x,y,a,b,c = map(int,input().split())
pl = list(map(int,input().split()))
ql = list(map(int,input().split()))
rl = list(map(int,input().split()))

pl = sorted(pl)
ql = sorted(ql)
rl = sorted(rl)
ansl = pl[-x:] + ql[-y:]

ansl += rl

ansl = sorted(ansl)
print(sum(ansl[-(x+y):]))
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May  3 13:26:56 2020

@author: r
"""

import sys

n = int(input())
t = [0]
x = [0]
y = [0]
b = 1

for i in range(n):
    a = list(map(int, input().split()))
    t += [a[0]]
    x += [a[1]]
    y += [a[2]]

for i in range(n):
    if (x[i]-x[i+1]+y[i]-y[i+1]-t[i]+t[i+1])%2 or (abs(x[i]-x[i+1])+abs(y[i]-y[i+1])-abs(t[i]-t[i+1])) > 0:
        b = 0
        break
        
    
if b == 0:
    print("No")
else:
    print("Yes")


### FIXED CODE ###

n, m = list(map(int, input().split()))
hs =  list(map(int, input().split()))
ans = [1]*n
roads = []
for i in range(m):
    roads += [list(map(int, input().split()))]
for road in roads:
    if hs[road[0]-1] <= hs[road[1]-1]:
        ans[road[0]-1] = 0
    if hs[road[0]-1] >= hs[road[1]-1]:
        ans[road[1]-1] = 0
print(ans.count(1))
n,m,k=map(int,input().split())
a=[map(int,input().split())]
b=[map(int,input().split())]

aa,bb=[0],[0]
for i in range(n):
  aa.append(aa[i]+a[i])
for i in range(m):
  bb.append(bb[i]+b[i])
ans,j=0,m
for i in range(n+1):
  if aa[i]>k:
    break
  while b[j]>k-aa[i]:
    j -= 1
  ans=max(ans,i+j)
print(ans)

### FIXED CODE ###

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

aa,bb=[0],[0]
for i in range(n):
  aa.append(aa[i]+a[i])
for i in range(m):
  bb.append(bb[i]+b[i])
ans,j=0,m
for i in range(n+1):
  if aa[i]>k:
    break
  while bb[j] > k-aa[i]:
    j -= 1
  ans=max(ans,i+j)
print(ans)
a = input()
b = input()
x = int(max(b))-int(min(b))
print(x)

### FIXED CODE ###

x = int(input())

if x%2 == 0:
  print(x)
else:
  print(x*2)
x = input()
y = x * x * X
print(int(y))

### FIXED CODE ###

x = int(input())
y = x * x * x
print(y)
import sympy

R = float(input())
round(2*sympy.pi.evalf(1000)*R, 100)

### FIXED CODE ###

import math
R = int(input())
print(2*math.pi*R)
import sys
import numpy as np
N=int(input())
nums=list(map(int,input().split(" ")))
ans_array=[]
#符号の統一
add=0
mode=0
if min(nums)>0: #全部正の場合
    mode=0
elif max(nums)<0: #全部負の場合
    mode=1
elif max(nums)==min(nums)==0: #全部0
    print("0")
    sys.exit()
else: #正負混合
    mode=2
count=0

if mode==2: #need to modify
    temp=[]
    if abs(max(nums))<abs(min(nums)):
        mode=1 #全部負にする
        add=min(nums)
        ind=np.argmin(nums)
    elif abs(max(nums))>abs(min(nums)):
        mode=0
        add=max(nums)
        ind=np.argmax(nums)
    for i in range(len(nums)):
        nums[i]+=add
        ans_array.append("{0} {1}".format(ind+1,i+1))
        count+=1
        
        

if mode==0: #全部正
    for i in range(len(nums)-1):
        nums[i+1]+=nums[i]
        count+=1
        ans_array.append("{0} {1}".format(i+1,i+2))
    print(count)
    for i in ans_array:
       print(i)
                

elif mode==1:
    nums.reverse()
    for i in range(len(nums)-1):
        nums[i+1]+=nums[i]
        count+=1    
        ans_array.append("{0} {1}".format(i+2,i+1))

    print(count)
    for i in ans_array:
       print(i)


### FIXED CODE ###

import sys
import numpy as np
N=int(input())
nums=list(map(int,input().split(" ")))
ans_array=[]
#符号の統一
add=0
mode=0
if min(nums)>0: #全部正の場合
    mode=0
elif max(nums)<0: #全部負の場合
    mode=1
elif max(nums)==min(nums)==0: #全部0
    print("0")
    sys.exit()
else: #正負混合
    mode=2
count=0

if mode==2: #need to modify
    temp=[]
    if abs(max(nums))<abs(min(nums)):
        mode=1 #全部負にする
        add=min(nums)
        ind=np.argmin(nums)
    elif abs(max(nums))>=abs(min(nums)):
        mode=0
        add=max(nums)
        ind=np.argmax(nums)
    for i in range(len(nums)):
        nums[i]+=add
        ans_array.append("{0} {1}".format(ind+1,i+1))
        count+=1
        
        

if mode==0: #全部正
    for i in range(len(nums)-1):
        nums[i+1]+=nums[i]
        count+=1
        ans_array.append("{0} {1}".format(i+1,i+2))
    print(count)
    for i in ans_array:
       print(i)
                

elif mode==1:
    nums.reverse()
    for i in range(len(nums)-1):
        nums[i+1]+=nums[i]
        count+=1    
        ans_array.append("{0} {1}".format(len(nums)-i,len(nums)-i-1))

    print(count)
    for i in ans_array:
       print(i)
a,b = map(int,raw_input().split(" "))
d = a / b
r = a % b
f = a * 1.0 / b
print "%s %s %s" %(d,r,f)

### FIXED CODE ###

a,b = map(int,raw_input().split())
d = a/b
r = a % b
f = float(a) / b
print "%d %d %f"%(d,r,f)
N = int(input())
Nx = input().split()
g = []
for x in Nx:
    if x % 2 == 0:
        g.append(x)

for i in g:
    if not i % 3 == 0:
        if not i % 5 == 0:
            print("DENIED")
            break
    else:
        continue
    print("APPROVED")

### FIXED CODE ###

N = int(input())
Nx = input().split()
g = []
for x in Nx:
    x = int(x)
    if x % 2 == 0:
        g.append(x)
ans = 0
for i in g:
    if not i % 3 == 0:
        if not i % 5 == 0:
            ans = 1
            break
        else:
          continue
    else:
        continue
if ans == 1:
    print("DENIED")
else:
    print("APPROVED")
n = int(input())
list = input().split(" ")
x = 1
if 0 in list:
  print(0)
else:
  for i in list:
    x = x * i
    if x > 10**18:
      print(-1)
      exit()
  print(x)


### FIXED CODE ###

n = int(input())
al = list(map(int, input().split()))
al.sort()
ans = 1
for a in al:
    ans *= a
    if ans > 10**18:
        print(-1)
        exit()
print(ans)
n = int(input())
a = list(map(int, input().split()))
q = int(input())

m = {}
for i in a:
    if i in m.keys():
        m[i] = m[i] + 1
    else:
        m[i] = 1

for i in range(q):
    b, c = map(int,input().split())
    m[c] = m[c] + m[b]
    m.pop(b)
    ans = 0
    for k in m:
        ans += m[k] * k
    print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
q = int(input())

m = {}
for i in a:
    if i in m.keys():
        m[i] = m[i] + 1
    else:
        m[i] = 1

ans = 0
for k in m:
    ans += m[k] * k

for i in range(q):
    b, c = map(int,input().split())
    if b in m.keys():
        t = 0
        if c in m.keys():
            t = m[c] * c
            m[c] = m[c] + m[b]
        else:
            m[c] = m[b]
        ans += m[c] * c - m[b] * b - t
        m.pop(b)
    print(ans)
if __name__ == '__main__':
    s = input().rstrip().split(' ')
    N,K = int(s[0]), int(s[1])
    cand1 = abs(N - K*math.ceil(N/float(K)))
    cand2 = abs(N - K*math.floor(N/float(K)))
    print(min(cand1, cand2))


### FIXED CODE ###

import math

if __name__ == '__main__':
    s = input().rstrip().split(' ')
    N,K = int(s[0]), int(s[1])
    if(N>=K):
        #cand1 = int(abs(N - int(K*math.ceil(N/float(K)))))
        #cand2 = int(abs(N - int(K*math.floor(N/float(K)))))
        cand1 = int(N%K)
        cand2 = int(K-(N%K))
        print(min(cand1, cand2))
    else:
        print(min(int(abs(N-K)),N))
N, K = map(int, input())
 
calc = []
for i in range(1, N+1):
  tmp = i
  cnt = 0
  while tmp <= K-1
    tmp*=2
    cnt+=1
  calc.append((1/N) * (1/(2*cnt)))

print(sum(calc))

### FIXED CODE ###

N, K = map(int, input().split())
 
calc = 0
for i in range(1, N+1):
  tmp = i
  cnt = 0
  while tmp <= K - 1:
    tmp*=2
    cnt+=1
  calc += (1/N) * (1/(2**cnt))

print(calc)
import string

# 1千兆 + 1
N = int(input())
n_digits = len(str(1000000000000001))
letters = string.ascii_lowercase

x = N
ans = []
# while True:
#     x -= 1
#     mod = x % 26
#     ans = [ mod ] + ans
#     x = x // 26
#     if x <= 0:
#         break

# print(ans)
# print("".join([ letters[v] for v in ans ]))

while True:
    x -= 1
    mod = x % 26
    # div = x // 26
    x = x // 26
    
    ans.append(mod)
    if div == 0:
        break

ans = ans[::-1]
print("".join([ letters[v] for v in ans ]))

### FIXED CODE ###

import string

# 1千兆 + 1
N = int(input())
n_digits = len(str(1000000000000001))
letters = string.ascii_lowercase

x = N - 1
ans = []
# while True:
#     mod = x % 26
#     ans = [ mod ] + ans
#     x = x // 26
#     if x <= 0:
#         if ans[0] == 0:
#             ans = [0] + ans
#         break

# print(ans)
# print("".join([ letters[v] for v in ans ]))

while True:
    mod = x % 26
    div = x // 26
    
    ans.append(mod)
    if div == 0:
        break
    x = div - 1

ans = ans[::-1]
# print(ans)
print("".join([ letters[v] for v in ans ]))
print(n)

### FIXED CODE ###

import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))
for i in range(1,n):
  if m%i==0 and (is_prime(i) or i==1) and is_prime(m//i) and (i==1 or m//i<n):
    print('1')
    exit()
for i in range(n,m+1):
  if i==m:
    print(1)
    break
  if m%i==0:
    print(m//i)
    break
  if m-i-n>0 and m%(m-i-n)==0 and m//(m-i-n)>n:
    print(m-i-n)
    break
while 1:
	n=input()
	if n==0:break
	hmax=1000
	block=[map(int,raw_input().split()) for i in range(n)]
	field=[[0]*5 for i in range(hmax)]
	for d,p,q in block:
		if d==1:
			for li in range(hmax-1,-1,-1):
				if field[li][q-1:q+p-1]!=[0]*p:
					field[li+1][q-1:q+p-1]=[1]*p
					break
			else:
				field[0][q-1:q+p-1]=[1]*p
		else:
			for li in range(hmax-1,-1,-1):
				if field[li][q-1]!=0:
					for i in range(p):
						field[li+i+1][q-1]=1
					break
			else:
				for i in range(p):
					field[li+i][q-1]=1
		i=0
		while 1:
			if field[i]==[1]*5:
				del field[i]
				hmax-=1
			elif field[i]==[0]*5:
				break
			else:
				i+=1
	print sum([sum(field[li]) for li in range(hmax)])

### FIXED CODE ###

while 1:
	n=input()
	if n==0:break
	hmax=7500
	block=[map(int,raw_input().split()) for i in range(n)]
	field=[[0]*5 for i in range(hmax)]
	top=[0]*5
	for d,p,q in block:
		if d==1:
			h=max(top[q-1:q-1+p])
			field[h][q-1:q-1+p]=[1]*p
			top[q-1:q-1+p]=[max(top)+1]*p
		else:
			h=top[q-1]
			for i in range(p):
				field[h+i][q-1]=1
			top[q-1]=h+p
		h=0
		while 1:
			if field[h]==[1]*5:
				del field[h]
				top=[x-1 for x in top]
			elif field[h]==[0]*5:
				break
			else:
				h+=1
		for w in range(5):
			for h in range(top[w]-1,-2,-1):
				if field[h][w]==1 or h==-1:
					top[w]=h+1
					break
	print sum([sum(field[h]) for h in range(max(top))])
D,N=map(int,input().split())
S=0
if D==0:
    if N=100:
        S=1
    print(N+S)
elif D==1:
    print(100*N)
else:
    print(10000*N)

### FIXED CODE ###

D,N=map(int,input().split())
S=0
if N==100:
    S=1
print(100**D*(N+S))
n, m = map(int,input().split())
a = list(int(input()) for _ in range(m))
dp = [[] for _ in range(n + 1)]
dp[0] = 1
# j = 0
if m = 0:
    dp[1] = 1
    for i in range(2, n + 1):
        dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007
    print(dp[n])
    exit()
if a[0] == 1:
    dp[1] = 0
    j = 1
else:
    dp[1] = 1
    j = 0
for i in range(2, n + 1):
    # print(i, dp)
    if j < m:
        if a[j]  == i:
            dp[i] = 0
            j += 1
            continue
    dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007
print(dp[n])

### FIXED CODE ###

n, m = map(int,input().split())
a = list(int(input()) for _ in range(m))
dp = [[] for _ in range(n + 1)]
dp[0] = 1
# j = 0
if m == 0:
    dp[1] = 1
    for i in range(2, n + 1):
        dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007
    print(dp[n])
    exit()
if a[0] == 1:
    dp[1] = 0
    j = 1
else:
    dp[1] = 1
    j = 0
for i in range(2, n + 1):
    # print(i, dp)
    if j < m:
        if a[j]  == i:
            dp[i] = 0
            j += 1
            continue
    dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007
print(dp[n])
from sys import stdin
H, A = map(int,stdin.readline().rstrip().split)

x = 1
while True:
  if 0 <= H/(A*x):
    H -= A
    a += 1
  else:
    break
print(x)

### FIXED CODE ###

H, A = map(int, input().split())

x = 0
while True:
  if H <= 0:
    break
  if H > 0:
    H -= A
    x += 1
print(x)
N,R=int(input( ).split( ))
ans=0
if N>=10:
  ans=R
  
else:
  ans=R+100*(10-N)
 
print(ans)


### FIXED CODE ###

N,R=map(int,input().split())
ans=0
if N>=10:
  ans=R
  
else:
  ans=R+100*(10-N)
 
print(ans)
import math
i = 1
z = 0
t = 0
n, d = map(int, input().split())
while i <= n:
    i += 1
    a, b = map(int, input().split())
    if math.sqrt(a**2 + b**2) <= d:
        t += 1

print(t)

### FIXED CODE ###

a = int(input())
if a >= 30:
    print('Yes')
else:
    print('No')
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    # 最短経路問題で使われるアルゴリズムの１つ。
    # グラフ上の全ての頂点間の最短経路を探す
    # 負の閉路（辺の重みの和が負になるような閉路）がない限り、負の辺があっても使える。

    # 負の閉路を持つ場合は'NEGATIVE CYCLE'を、そうでない場合には(i,j)成分に
    # 頂点iから頂点jへの最短経路の距離を格納するdist_listをprintする関数
    def warshall_floyd(v_num, dist_lst):
        # 負の閉路を持つか
        negative_cycle_flag = False

        # 頂点iから頂点jへの経路と、頂点kを経由した場合の経路とを比較して
        # よりコストの合計が小さい方を配列に入れる動的計画法
        for k in range(v_num):
            for i in range(v_num):
                for j in range(v_num):
                    # i→k→jがつながっててしかもi→jルートよりもイケてるなら更新
                    if dist_lst[i][k] != INF and dist_lst[k][j] != INF:
                        if dist_lst[i][j] > dist_lst[i][k] + dist_lst[k][j]:
                            dist_lst[i][j] = dist_lst[i][k] + dist_lst[k][j]

        for v in range(v_num):
            # dist_lstに負の数が格納されているとは、
            # グラフが負の閉路を持つことを意味する
            if dist_lst[v][v] < 0:
                negative_cycle_flag = True

        return dist_lst

    H, W = map(int, input().split())
    # 頂点の数と辺の数
    v_num, e_num = 10, 100

    # 配列dist_lst[a][b]には頂点a,b間の辺のコストを入れておき、
    # a=bの時は0を、a,b間の辺が存在しないときはINFを入れておく。
    INF = 10 ** 20
    dist_lst = [[INF] * v_num for _ in range(v_num)]

    costs = [[i for i in list(map(int, input().split()))] for _ in range(10)]
    for s in range(10):
        for t in range(10):
            dist_lst[s][t] = costs[s][t]

    dist_lst = warshall_floyd(v_num, dist_lst)
    wall = [[i for i in list(map(int, input().split()))] for _ in range(10)]
    cnt = 0
    for h in range(H):
        for w in range(W):
            val = wall[h][w]
            if val != -1:
                cnt += dist_lst[val][1]
    print(cnt)


resolve()

### FIXED CODE ###

from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall

import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    H, W = map(int, input().split())

    graph = [[i for i in list(map(int, input().split()))] for _ in range(10)]
    graph = csr_matrix(graph)

    dist_matrix = floyd_warshall(csgraph=graph, directed=True, return_predecessors=False)
    dist_matrix = list(dist_matrix)

    wall = [[i for i in list(map(int, input().split()))] for _ in range(H)]

    cnt = 0
    for h in range(H):
        for w in range(W):
            val = wall[h][w]
            if val != -1 and val != 1:
                cnt += dist_matrix[val][1]
    print(int(cnt))


resolve()
S,T=map(input().split())
print('{}{}'.format(T,S))
      

### FIXED CODE ###

S,T=map(str,input().split())
print('{}{}'.format(T,S))