Harryxun/stf_run huggingface dataset:
N = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7
a = max(A)
prime_num = [2]
count = [0 for _ in range(a+1)]
count[2] = 1
for k in range(3, a+1, 2):
  if count[k] == 0:
    count[k] = 1
    prime_num.append(k)
    for j in range(k, a+1, k):
      count[k] = 1
baisu = []
count = [0 for _ in range(a+1)]
for k in range(N):
  b = 0 + A[k]
  for p in prime_num:
    if p**2 <= b:
      if count[p] == 0 and b%p == 0:
        baisu.append(p)
      c = 0
      while b % p == 0:
        b //= p 
        c += 1 
      if c > count[p]:
        count[p] = c
    else:
      break
  if b != 1:
    if count[b] == 0:
      count[b] = 1
      baisu.append(b)

product = 1
for item in baisu:
  product *= pow(item, count[item], mod)
  product %= mod

b = mod-2
blis = []
c = 0
while b >0:
  if b & 1 == 1:
    blis.append(c)
  c += 1
  b >>= 1

def modinv(a):
  if a == 1:
    return 1
  else:
    res = 1
    li = []
    for _ in range(c):
      li.append(a%mod)
      a = a*a%mod
    for item in blis:
      res = res *li[item] %mod
    return res

ans = 0
for k in range(N):
  ans += product*modinv(A[k])
  ans %= mod

print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7
a = max(A)
prime_num = [2]
sgn = [0 for _ in range(max(int(a**0.5)+1, 4))]
sgn[2] = 1
for k in range(3, len(sgn), 2):
  if sgn[k] == 0:
    prime_num.append(k)
    for j in range(k, a+1, 2*k):
      sgn[k] = 1
baisu = []
count = [0 for _ in range(a+1)]
for k in range(N):
  b = 0 + A[k]
  for p in prime_num:
    if p**2 <= b:
      if b%p == 0:
        if count[p] == 0:
          baisu.append(p)
        c = 0
        while b % p == 0:
          b //= p 
          c += 1 
        if c > count[p]:
          count[p] = c
    else:
      break
  if b != 1:
    if count[b] == 0:
      count[b] = 1
      baisu.append(b)

product = 1
for item in baisu:
  product *= pow(item, count[item], mod)
  product %= mod

b = mod-2
blis = []
c = 0
while b >0:
  if b & 1 == 1:
    blis.append(c)
  c += 1
  b >>= 1

def modinv(a):
  if a == 1:
    return 1
  else:
    res = 1
    li = []
    for _ in range(c):
      li.append(a%mod)
      a = a*a%mod
    for item in blis:
      res = res *li[item] %mod
    return res

ans = 0
for k in range(N):
  ans += product*modinv(A[k])
  ans %= mod

print(ans)
n, m, d = map(int, input().split())
p = 1/n if d==0 else p = 2*(n-d)/n/n
ans = (m-1)*p
print(ans)

### FIXED CODE ###

n, m, d = map(int, input().split())
p = 1/n if d==0 else 2*(n-d)/n/n
ans = (m-1)*p
print(ans)
li = [int(i) for i in input().split()]
for i in range(5):
	if li[i] == 0:
    		print(i+1)
            exit()

### FIXED CODE ###

#template
def inputlist(): return [int(j) for j in input().split()]
#template
li = inputlist()
for i in range(5):
    if li[i] == 0:
        print(i+1)
import math

N=int(input())
def primes(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n+1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

def factorization(n,A):
    a=[]
    for i in A:
        if n%i==0:
            a.append(i)
    return a

A=primes(N)
print(1)
a=factorization(N,A)
print(2)

ans=0
for i in a:
    e=int(math.log(N,i))
    x=0
    for j in range(1,100):
        x+=j
        if e>=x:
            ans+=1

print(ans)

### FIXED CODE ###

P = [1 for _ in range(10**6)]
P[0]=0
P[1]=0
for i in range(2,10**3):
    for j in range(i*i,10**6,i):
        P[j] = 0
Q = []
for i in range(2,10**6):
    if P[i]==1:
        Q.append(i)
N = int(input())
C = {}
for q in Q:
    if N%q==0:
        C[q] = 0
        while N%q==0:
            N = N//q
            C[q] += 1
if N>1:
    C[N] = 1
cnt = 0
for q in C:
    k = C[q]
    n = 1
    while k>(n*(n+1))//2:
        n += 1
    if k==(n*(n+1))//2:
        cnt += n
    else:
        cnt += n-1
print(cnt)
import collections

n = int(input())
v = list(map(int, input().split()))
a = v[::2]
b = v[1::2]
ac = collections.Counter(a)
bc = collections.Counter(b)
ac = sorted(ac.items(), key=lambda x: x[1], reverse=True)
bc = sorted(bc.items(), key=lambda x: x[1], reverse=True)
if ac[0][0] == bc[0][0]:
    if len(ac) == len(bc) and len(ac) == 1:
        print(ac[0][1])
        exit()
    i = 0
    while ac[i][1] == bc[i][1]:
        i += 1
    if ac[i][1] > bc[i][1]:
        ac.remove(ac[i])
        bc.remove(bc[0])
    elif ac[i][1] < bc[i][1]:
        ac.remove(ac[0])
        bc.remove(bc[i])
else:
    ac.remove(ac[0])
    bc.remove(bc[0])
ans = 0
for i in range(len(ac)):
    ans += ac[i][1]
for i in range(len(bc)):
    ans += bc[i][1]
print(ans)


### FIXED CODE ###

import collections

n = int(input())
v = list(map(int, input().split()))
a = v[::2]
b = v[1::2]
ac = collections.Counter(a)
bc = collections.Counter(b)
ac = sorted(ac.items(), key=lambda x: x[1], reverse=True)
bc = sorted(bc.items(), key=lambda x: x[1], reverse=True)
if ac[0][0] == bc[0][0]:
    if len(ac) == len(bc) and len(ac) == 1:
        print(ac[0][1])
        exit()
    i = 0
    while ac[i][1] == bc[i][1]:
        i += 1
        if i == len(ac) - 1 or i == len(bc) - 1:
            break
    if ac[i][1] > bc[i][1]:
        ac.remove(ac[i])
        bc.remove(bc[0])
    elif ac[i][1] < bc[i][1]:
        ac.remove(ac[0])
        bc.remove(bc[i])
    else:
        ac.remove(ac[0])
        bc.remove(bc[1])
else:
    ac.remove(ac[0])
    bc.remove(bc[0])
ans = 0
for i in range(len(ac)):
    ans += ac[i][1]
for i in range(len(bc)):
    ans += bc[i][1]
print(ans)
n=int(input())
s=int(input())
if n==s:
  print(n+1)
  exit()
if (n+3)//2<=s:
  print(-1)
  exit()
ewew

### FIXED CODE ###

import sys
def yakusu(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
N=int(input())
K=int(input())
if N==K:
  print(N+1)
  exit()
if N<K:
  print(-1)
  exit()
L=list()
setL=set()
#N-Kはa-1の倍数
L=yakusu(N-K)
L=[i+1 for i in L]
for i in L:
  ans=0
  m=N
  while True:
    if m<i:
      ans+=m
      break
    else:
      ans+=m%i
      m=m//i
  if ans==K:
    print(i)
    exit()
print(-1)
import sys

dList = list()

for i,d in sys.stdin:
  if i != 0: #1行目の行数情報はいらないので読み飛ばす
    dList.append(d)

print(len(set(dList)))

### FIXED CODE ###

n = int(input())

dList = [int(input()) for i in range(n)]

print(len(set(dList)))
AB = list(input().split())
 
A = int(AB[0])
B = float(AB[1])
 
B = round(B * 100)
 
ans = int(A * B / /100)
 
print(ans)

### FIXED CODE ###

AB = list(input().split())
 
A = int(AB[0])
B = float(AB[1])
 
B = round(B * 100)
 
ans = int(A * B // 100)
 
print(ans)
a=int(input())
b=int(input())

if int(a*b%2) == 0:
    print('Even')
else:
    print('Odd')

### FIXED CODE ###

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

if a*b%2 == 0:
    print('Even')
else:
    print('Odd')
import sys

import numpy as np

s = raw_input()
x, y = [int(x) for x in raw_input().split(" ")]

s = s + "T"

a = []
b = []

cum_len = 0
turn = 0
for command in s:
    if command == "F":
        cum_len += 1
    elif command == "T":
        (a if turn == 0 else b).append(cum_len)
        turn ^= 1
        cum_len = 0

a0 = a.pop(0)

alpha = abs(x-a0)
beta = abs(y)

targetX = sum(a) - alpha
targetY = sum(b) - beta

def search(a, target):
    forwardTable = np.zeros((len(a), target+1))
    forwardTable[:,0] = 1
    for i_i in xrange(len(a)):
        new_item = a[i_i]
        if i_i == 0:
            forwardTable[i_i, new_item] = 1
        else:
            forwardTable[i_i] += forwardTable[i_i-1]
            forwardTable[i_i,new_item:] += forwardTable[i_i,:-new_item]
        if forwardTable[i_i,-1] > 0:
            forwardTable[-1,-1] = 1
            break

    return (forwardTable[-1,-1]>0)

if (targetX < 0) or (targetY < 0):
    print "No"
    sys.exit()
else:
    if (targetX > 0):
        if not search(a, targetX):
            print "No"
            sys.exit()
    if (targetY > 0):
        if not search(b, targetY):
            print "No"
            sys.exit()
    print "Yes"

### FIXED CODE ###

import sys

import numpy as np

s = raw_input()
x, y = [int(x) for x in raw_input().split(" ")]

s = s + "T"

a = []
b = []

cum_len = 0
turn = 0
for command in s:
    if command == "F":
        cum_len += 1
    elif command == "T":
        (a if turn == 0 else b).append(cum_len)
        turn ^= 1
        cum_len = 0

a0 = a.pop(0)

alpha = abs(x-a0)
beta = abs(y)

targetX = sum(a) - alpha
targetY = sum(b) - beta

def search(a, target):
    forwardTable = np.zeros((len(a), target+1))
    forwardTable[:,0] = 1
    for i_i in xrange(len(a)):
        new_item = a[i_i]
        if i_i == 0:
            forwardTable[i_i, 2*new_item:2*new_item+1] = 1
        else:
            forwardTable[i_i] += forwardTable[i_i-1]
            if new_item>0:
                forwardTable[i_i,2*new_item:] += forwardTable[i_i-1,:-2*new_item]
        if forwardTable[i_i,-1] > 0:
            forwardTable[-1,-1] = 1
            break

    return (forwardTable[-1,-1]>0)

if (targetX < 0) or (targetY < 0):
    print "No"
    sys.exit()
else:
    if (targetX > 0):
        if not search(a, targetX):
            print "No"
            sys.exit()
    if (targetY > 0):
        if not search(b, targetY):
            print "No"
            sys.exit()
    print "Yes"
cnt = 0
def s(start, end):
    global cnt
    if(start==len(S)-1):
        return cnt
    numS = int(S[start:end])
    if(numS%2019==0):
        cnt += 1
    if(end==len(S)-1):
        end = start+2
        s(start+1, end)
        return
    s(start, end+1)



if __name__ == '__main__':
    S = input()
    s(0, 1)
    print(cnt)

### FIXED CODE ###

S = list(map(int, list(input())))[::-1]
N = len(S)
CNT = [0]*2019
CNT[0] = 1
num = 0
d = 0
for i in range(N):
    num += S[i]*pow(10, d, 2019)
    num %= 2019
    CNT[num] += 1
    d += 1
ans = 0 
for cnt in CNT:
    ans += (cnt*(cnt - 1)) // 2
print(ans)
s = input()
t = input()
if len(s) < len(t):
  print("UNRESTORABLE")
  exit()

start = -1
for i in range(len(s)-len(t)+1):
  for j in range(len(t)):
    if s[i+j] != "?" and s[i+j] != t[j]:
      break
  else:
    start = i

if start == -1:
  print("UNRESTORABLE")
else:
  ans_list = list(s)
  for i in range(len(ans_list)):
    if start <= i <= start+len(t):
      ans_list[i] = t[i-start]
    elif ans_list[i] == "?":
      ans_list[i] = "a"
  print("".join(ans_list))
    
    

### FIXED CODE ###

s = input()
t = input()
if len(s) < len(t):
  print("UNRESTORABLE")
  exit()

start = -1
for i in range(len(s)-len(t)+1):
  for j in range(len(t)):
    if s[i+j] != "?" and s[i+j] != t[j]:
      break
  else:
    start = i

if start == -1:
  print("UNRESTORABLE")
else:
  ans_list = list(s)
  for i in range(len(ans_list)):
    if start <= i < start+len(t):
      ans_list[i] = t[i-start]
    elif ans_list[i] == "?":
      ans_list[i] = "a"
  print("".join(ans_list))
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

import heapq

def main():
  n = int(input())
  T = [[] for _ in range(n+1)]
  for i in range(1, n):
    T[int(input())].append(i)

  def dfs(v):
    if not T[v]:
      return 0
    L = []
    for i in T[v]:
      heapq.heappush(L, dfs(i)+1)
    temp = heapq.heappop(L)
    while L:
      temp = max(temp+1, heapq.heappop(L))
    return temp

  ans = dfs(1)
  print(ans)
  
if __name__ == "__main__":
  main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

n = int(input())
T = [[] for _ in range(n)]
for i in range(1, n):
  a = int(input())
  a -= 1
  T[a].append(i)

def dfs(v):
  if not T[v]:
    return 0
  L = [dfs(i)+1 for i in T[v]]
  L.sort()
  for i in range(len(T[v]) - 1):
    L[i+1] = max(L[i]+1, L[i+1])
  return L[-1]

ans = dfs(0)
print(ans)
def main():
    s  = int(input())
    k = s//100
    t = s%100

    if(k>0 and k<13) and (t>0 and t<13):
        res = "AMBIGUOUS"
    elif(k>0 and k<13) and
        res = "MMYY"
    elif(t>0 and t<13):
        res = "YYMM"
    else:
        res = "NA"
    print(res)






if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    s  = int(input())
    k = s//100
    t = s%100

    if(k>0 and k<13) and (t>0 and t<13):
        res = "AMBIGUOUS"
    elif(k>0 and k<13):
        res = "MMYY"
    elif(t>0 and t<13):
        res = "YYMM"
    else:
        res = "NA"
    print(res)






if __name__ == '__main__':
    main()
n=int(input())
xyh=[list(map(int,input().split())) for i in range(n)]
xyh=sorted(xyh,reverse=True,key=lambda x:x[2])
p#rint(xyh)
for cx in range(0,101):
    for cy in range(0,101):
        H = 0
        for x,y,h in xyh:
            if H == 0:
                H = h + abs(x - cx) + abs(y - cy)
            else:
                temp_H = h + abs(x - cx) + abs(y - cy)
                if temp_H != H:break
        else:
            if H>=1:
                print(cx,cy,H)
                exit()


### FIXED CODE ###

n=int(input())
xyh=[list(map(int,input().split())) for i in range(n)]
xyh=sorted(xyh,reverse=True,key=lambda x:x[2])
#print(xyh)
for cx in range(0,101):
    for cy in range(0,101):
        H = xyh[0][2] + abs(xyh[0][0] - cx) + abs(xyh[0][1]-cy)
        for x,y,h in xyh:
            if h!= max(H - abs(x - cx) - abs(y - cy),0):
                break

        else:
            if H>=1:
                print(cx,cy,H)
                exit()
N,X=map(int,input().split())
M=[input() for i in range(N)]
print((X-sum(M))//min(M)+N)

### FIXED CODE ###

N,X=map(int,input().split())
M=[int(input()) for i in range(N)]
print((X-sum(M))//min(M)+N)
N, Q = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N - 1)]
px = [list(map(int, input().split())) for i in range(Q)]

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

for i in range(N - 1):
    a = ab[i][0]
    b = ab[i][1]
    path[a].append(b)
    path[b].append(a)

for i in range(Q):
    p = px[i][0]
    x = px[i][1]
    result[p] = result[p] + x


def dfs(point, result):
    next_arr = path[point]
    for i in range(len(next_arr)):
        next_p = next_arr[i]
        path[next_p].remove(point)
        result[next_p] = result[next_p] + result[point]
        if len(path[next_p]) != 0:
            dfs(next_p, result)


dfs(1, result)

print(*result[1:])

### FIXED CODE ###

N, Q = map(int,input().split()) # 複数の数字を変数に格納
List_ab = [list(map(int,input().split())) for i in range(N-1)] # [[1,2],[3,4],[5,6]]
List_px = [list(map(int,input().split())) for i in range(Q)] # [[1,2],[3,4],[5,6]]

count_list = [0]*N

List_ab.sort()

for i in range(Q):
    count_list[List_px[i][0]-1] += List_px[i][1]
        
for i in range(N-1):
    count_list[List_ab[i][1]-1] += count_list[List_ab[i][0]-1]
    
print(*count_list)
W , H, x, y、r = map(int, input().split())

if r <= x and x <= W -r and r <= y and y<= H -r:

    print("Yes")

else:
    print("No")



### FIXED CODE ###

W, H, x, y, r = map(int, input().split())

if r <= x and x <= (W - r):
    if r <= y and y <= (H - r):
        print("Yes")
    else:
        print("No")

else:
    print("No")
#!/usr/bin/python3
# -*- coding:utf-8 -*-

from collections import defaultdict

def main():
  n = int(input())
  tree = defaultdict(lambda : {'parent':-1, 'score':0, 'children':[]})
  weights = dict()
  for _ in range(n-1):
    a, b, c = map(int, input().split())
    tree[a]['children'].append(b)
    tree[b]['children'].append(a)
    weights[(a, b)] = weights[(b, a)] = c
    
  q, k = map(int, input().split())  
  visited = []
  iroot = k
  def dfs(inode, score=0):
    visited.append(inode)
    for ichild in tree[inode]['children']:
      if ichild in visited:
        continue
      tree[ichild]['score'] = weights[(inode, ichild)] + score
      tree[ichild]['parent'] = inode
      dfs(ichild, tree[ichild]['score'])
  dfs(iroot)
  for _ in range(q):
    x, y = map(int, input().split())
    print(tree[x]['score'] + tree[y]['score'])

if __name__=='__main__':
  main()



### FIXED CODE ###

#!/usr/bin/python3
# -*- coding:utf-8 -*-

import sys
sys.setrecursionlimit(10**9)

def main():
  n = int(input())
  inode2scores = [0] * (n+1)
  tree = [[] for _ in range(n+1)]
  weights = dict()
  for _ in range(n-1):
    a, b, c = map(int, input().split())
    tree[a].append(b)
    tree[b].append(a)
    weights[(a, b)] = weights[(b, a)] = c
    
  q, k = map(int, input().split())  
  visited = [False] * (n+1)
  iroot = k
  def dfs(inode, score=0):
    visited[inode] = True
    for ichild in tree[inode]:
      if visited[ichild]:
        continue
      inode2scores[ichild] = weights[(inode, ichild)] + score
      dfs(ichild, inode2scores[ichild])
  dfs(iroot)
  for _ in range(q):
    x, y = map(int, input().split())
    print(inode2scores[x] + inode2scores[y])

if __name__=='__main__':
  main()
a=int(input().split())
b=a[0]/a[1]
print(round(-5,b))

### FIXED CODE ###

a=input().split()
b=int(a[0])/int(a[1])
c=float(b)
print(round(c,5))
import sys
from operator import mul
from functools import reduce
sys.setrecursionlimit(9**9)
def P(a,n,p):
  bi=str(format(n,"b"))
  res=1
  for i in range(len(bi)):
    res=(res*res)%p
    if bi[i]=="1":
      res=(res*a)%p
  return res
n,a,b=map(int,input().split())
a,b=min(a,n-a),min(b,n-b)
m=10**9+7
N=min(n,2*10**5)
inv=[0 for _ in range(max(a,b))]
inv[1]=1
if max(a,b)>1:
  for i in range(2,max(a,b)):
    inv[i]=m-inv[m%i]*(m//i)%m
def C(n,r,a):
  for i in range(r):
    a=a*(n-i)*inv[r-i-1]%m
  return a
A,B=C(n,a,1),C(n,b,1)
print((P(2,n,m)-int(A)-int(B)-1+m)%m)

### FIXED CODE ###

n,a,b=map(int,input().split())
c=d=1
e=0
m=10**9+7
for i in range(1,b+1):
    c=(c*(n+1-i))%m
    d=(d*i)%m
    if i==a or i==b:
        e+=c*pow(d,m-2,m)%m
print((pow(2,n,m)-e-1)%m)
N=int(input())
S=input()
count=0
for i in range(N):
    if (S[i:i+3]=="ABC"):
        count=count+1
print(count)

### FIXED CODE ###

a, b = map(int, input().split())
if(a * 500 >= b):
  print("Yes")
else:
  print("No")
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))

x,y,z map(int,input().split())

ans = 1
memo = y+2*z

while(memo<=x):
    ans += 1
    memo += y+z

print(ans-1)

### FIXED CODE ###

#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))

x,y,z = map(int,input().split())

ans = 1
memo = y+2*z

while(memo<=x):
    ans += 1
    memo += y+z

print(ans-1)
A, B, C, D = map(int, input().split())
num = 0
if A <= B:
    if C <= D:
        print(A+C)
    else:
        print(A+D)
else:
    if C<= D:
        print(B+C)
    else:
        print(B+D)

### FIXED CODE ###

A = [int(input()) for i in range(4)]
print(min(A[0], A[1])+min(A[2], A[3]))
import math

def combain(X, Y):
    return int(math.factorial(X) / math.factorial(Y))

N = int(input())
S = []

ans = 0

for i in range(N):
    S.append(sorted(input()))

S.sort()

ans = 0

X = 1
for i in range(N-1):
    if S[i] == S[i+1]:
        X += 1
    elif X > 1:
        C = combain(X, 2)
        X = 1
        ans += C

if X > 1:
    C = combain(X, 2)
    X = 1
    ans += C

print(ans)



### FIXED CODE ###


def combain(X, Y):
    return int(( X * (X - 1)) / Y)

N = int(input())
S = []

ans = 0

for i in range(N):
    S.append(sorted(input()))

S.sort()

ans = 0

X = 1
for i in range(N-1):
    if S[i] == S[i+1]:
        X += 1
    elif X > 1:
        C = combain(X, 2)
        X = 1
        ans += C

if X > 1:
    C = combain(X, 2)
    X = 1
    ans += C
    
print(ans)
import numpy as np

D, G = map(int, input().split())

PC = []
ans = 10 ** 9

for _ in range(D):
    PC.append(list(map(int, input().split())))

PC = np.array(PC)

for i in range(2 ** D):
    score = 0
    count = 0

    for j in range(D):
        if (i >> j) & 1:

          	score += (j+1) * 100 * PC[j,0] + PC[j,1]
            count += PC[j,0]

    if score >= G:
        ans = min(ans, count)

    if score < G:
      for k in range(D):
            sub_score = 0
            sub_count = 0

            if ~(i >> k) & 1:
                for _ in range(PC[k,0] - 1):
                    sub_score += (k+1) * 100
                    sub_count += 1
                    if sub_score >= (G - score):
                        ans = min(ans, count+sub_count)
                        break


print(ans)

### FIXED CODE ###

import numpy as np

D, G = map(int, input().split())

PC = []
ans = 10 ** 9

for _ in range(D):
    PC.append(list(map(int, input().split())))

PC = np.array(PC)

for i in range(2 ** D):
    score = 0
    count = 0

    for j in range(D):
        if (i >> j) & 1:
            score += (j+1) * 100 * PC[j,0] + PC[j,1]
            count += PC[j,0]

    if score >= G:
        ans = min(ans, count)

    if score < G:
      for k in range(D):
            sub_score = 0
            sub_count = 0

            if ~(i >> k) & 1:
                for _ in range(PC[k,0] - 1):
                    sub_score += (k+1) * 100
                    sub_count += 1
                    if sub_score >= (G - score):
                        ans = min(ans, count+sub_count)
                        break

print(ans)
def getlist():
    return list(map(int, input().split()))
  
a,b = getList()
lis = []
for i in range(a):
  lis.append(input().strip())
  
lis.sort()
print("".join(lis))

### FIXED CODE ###

def getlist():
    return list(map(int, input().split()))
  
a,b = getlist()
lis = []
for i in range(a):
  lis.append(input().strip())
  
lis.sort()
print("".join(lis))
# coding: utf-8
import math
A,B,C,D = map(int,input().split())

CD = C * D // math.gcd(C,D) 

tgC = int(B/C) - int((A-1)/C)
tgD = int(B/D) - int((A-1)/D)
tgCD = int(B/CD) - int((A-1)/CD)


print((B-A+1)-(tgC+tgD-tgCD))

### FIXED CODE ###

A,B,C,D = map(int,input().split())

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

CD = C * D // gcd(C,D) 

tgC = max(B//C - (A-1)//C, 0)
tgD = max(B//D - (A-1)//D, 0)
tgCD = max(B//CD - (A-1)//CD, 0)

print((B-A+1)-(tgC+tgD-tgCD))
N,K=map(int,input().split())
X=list(map(int,input().split()))
if X[0]>=0:
    b=X[K]
elif X[-1]<=0:
    b=abs(X[-K])
elif 0 in X:
    a=0
    b=10**9
    for i in range(N):
        if X[i]==0:
            a=i
            break
    for j in range(max(0,K-1-a),min(K,N-a)):
        if b>X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1])):
            b=X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1]))
else:
    a=0
    b=10**9
    for i in range(N):
        if X[i]>0:
            a=i
            break
    for j in range(max(-1,K-a-1),min(K,N-a)):
        if b>X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1])):
            b=X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1]))
print(b)

### FIXED CODE ###

N,K=map(int,input().split())
X=list(map(int,input().split()))
if X[0]>=0:
    b=X[K-1]
elif X[-1]<=0:
    b=abs(X[-K])
elif 0 in X:
    a=0
    b=10**9
    for i in range(N):
        if X[i]==0:
            a=i
            break
    for j in range(max(0,K-1-a),min(K,N-a)):
        if b>X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1])):
            b=X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1]))
else:
    a=0
    b=10**9
    for i in range(N):
        if X[i]>0:
            a=i
            break
    for j in range(max(-1,K-a-1),min(K,N-a)):
        if b>X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1])):
            b=X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1]))
print(b)
s=list(input())
t=list(input())
if s[0:-1]==t[0:-2] and len(s)+1==len(t)　and t[-1].islower()==True:
  print('Yes')
  
else:
  print('No')



### FIXED CODE ###

import copy
s=list(input())
t=list(input())

if len(s)==len(t)-1 and t[:len(s)]==s:
  print('Yes')
else:
  print('No')
import sys

Weather = input()

if Weather = 'Sunny' :
  print('Cloudy')
elif Weather = 'Cloudy' :
  print('Rainy')
else :
  print('Sunny')
  



### FIXED CODE ###


Weather = input()

if Weather == 'Sunny' :
  print('Cloudy')
elif Weather == 'Cloudy' :
  print('Rainy')
else :
  print('Sunny')