CodeEff/ECCO huggingface dataset:
# Original solution
import copy

from typing import List, Tuple


def main():
    d, g = list(map(int, input().split()))
    v = []
    for _ in range(d):
        p, c = list(map(int, input().split()))
        v.append((p, c))

    print((ag(v, g)))


def ag(v: List[Tuple[int, int]], g: int) -> int:
    # ex. [(3, 500), (5, 800)] -> [(1, 3, 500), (2, 5, 800)]
    v = [(i, p, c) for i, (p, c) in enumerate(v, 1)]

    result = 100 ** 10
    for j in range(2 ** len(v)):
        cb = []
        for k in range(len(v)):
            if ((j >> k) & 1):
                cb.append(v[k])

        sc = 0
        cnt = 0
        # calc bonus score
        for (i, p, c) in cb:
            sc += i * 100 * p + c
            cnt += p

        for idx in reversed(list(range(len(v)))):
            if sc >= g:
                break
            if v[idx] in cb:
                continue
            i, p, _ = v[idx]
            for _ in range(p - 1):
                if sc >= g:
                    break
                sc += i * 100
                cnt += 1

        if sc >= g:
            result = min(result, cnt)
    return result


if __name__ == '__main__':
    main()


# Optimized solution
import itertools
from typing import List, Tuple


def main():
    d, g = list(map(int, input().split()))
    v = []
    for _ in range(d):
        p, c = list(map(int, input().split()))
        v.append((p, c))

    print((ag(v, g)))


def ag(v: List[Tuple[int, int]], g: int) -> int:
    # ex. [(3, 500), (5, 800)] -> [(1, 3, 500), (2, 5, 800)]
    v = [(i + 1, v[i][0], v[i][1]) for i in range(len(v))]

    result = 100 ** 10

    for j in range(len(v) + 1):
        for cb in itertools.combinations(v, j):
            sc = 0
            cnt = 0
            # calc bonus score
            for (i, p, c) in cb:
                sc += i * 100 * p + c
                cnt += p

            for idx in reversed(list(range(len(v)))):
                if sc >= g:
                    break
                if v[idx] in cb:
                    continue
                i, p, _ = v[idx]
                for _ in range(p - 1):
                    if sc >= g:
                        break
                    sc += i * 100
                    cnt += 1

            if sc >= g:
                result = min(result, cnt)
    return result


if __name__ == '__main__':
    main()
# Original solution
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import math
import sys
input = sys.stdin.readline

D, G = list(map(int, input().split()))
# print(D, G)
P = []
C = []
for i in range(D):
    p,  c = list(map(int, input().split()))
    P.append(p)
    C.append(c)

INF = 10**15


def F(i, n, GetPoint):
    if i == D:
        if GetPoint >= G:
            return n, GetPoint
        else:
            return INF, INF

    PerPoint = (i+1)*100

    if GetPoint < G:
        temp = INF, INF
        for j in range(P[i]+1):
            if j != P[i]:
                N, GP = F(i+1, n+j, GetPoint+j*PerPoint)
            else:
                N, GP = F(i+1, n+j, GetPoint+j*PerPoint + C[i])
            if N < temp[0]:
                temp = N, GP
        return temp
    else:
        return n, GetPoint


print((F(0, 0, 0)[0]))


# Optimized solution
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import math
import sys
input = sys.stdin.readline

D, G = list(map(int, input().split()))
# print(D, G)
P = []
C = []
for i in range(D):
    p,  c = list(map(int, input().split()))
    P.append(p)
    C.append(c)

INF = 10**15


def F(i, n, GetPoint):
    if i == D:
        if GetPoint >= G:
            return n, GetPoint
        else:
            return INF, INF

    PerPoint = (i+1)*100

    if GetPoint < G:
        ANS = INF, INF
        # ALL
        N, GP = F(i+1, n+P[i], GetPoint+PerPoint*P[i] + C[i])
        if N < ANS[0]:
            ANS = N, GP
        # through
        N, GP = F(i+1, n, GetPoint)
        if N < ANS[0]:
            ANS = N, GP

        # part
        # 上位合計
        PupperAll = sum([(j+1)*100*P[j] + C[j] for j in range(i+1, D)])
        rN = math.ceil((G - GetPoint - PupperAll)/PerPoint)
        if 0 < rN < P[i]:
            GP = GetPoint + PerPoint*rN + PupperAll
            N = n + rN + sum(P[i+1:])
            if N < ANS[0]:
                ANS = N, GP

        return ANS
    else:
        return n, GetPoint


print((F(0, 0, 0)[0]))
# Original solution

ans = float("inf")


def solve():

    d, g = list(map(int, input().split()))
    pc = [list(map(int, input().split())) for i in range(d)]

    # まだ解いてない配点を nokori として持つ
    def dfs(i, sum, count, nokori):
        global ans
        if i == d:
            # G 点に満たなければ nokori のうち一番大きいものを解く
            if sum < g:
                use = max(nokori)
                # 解く問題が問題数を超えないように注意
                n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))
                count += n
                sum += n * use * 100

            if sum >= g:
                ans = min(ans, count)
        else:
            # 総合スコア、解いた問題数、まだ解いてない問題を更新
            dfs(i + 1, sum, count, nokori)
            dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 +
                pc[i][1], count + pc[i][0], nokori - {i + 1})

    dfs(0, 0, 0, set(range(1, d + 1)))
    print(ans)


if __name__ == "__main__":
    solve()


# Optimized solution
d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for i in range(d)]

# まだ解いてない配点を nokori として持つ
ans = float("inf")


def dfs(i, sum, count, nokori):
    global ans
    if i == d:
        # G 点に満たなければ nokori のうち一番大きいものを解く
        if sum < g:
            use = max(nokori)
            # 解く問題が問題数を超えないように注意
            n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))
            count += n
            sum += n * use * 100

        if sum >= g:
            ans = min(ans, count)
    else:
        # 総合スコア、解いた問題数、まだ解いてない問題を更新
        dfs(i + 1, sum, count, nokori)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 +
            pc[i][1], count + pc[i][0], nokori - {i + 1})


dfs(0, 0, 0, set(range(1, d + 1)))
print(ans)
# Original solution
D,G = list(map(int,input().split()))
X = [list(map(int,input().split())) for _ in range(D)]
ans = 0

for i in range(2**D):
	point = 0
	count = 0
	for j in range(D):
		if (i>>j)&1:
			point += 100*(j+1)*X[j][0]+X[j][1]
			count += X[j][0]
	if 	G > point:
		for k in range(D)[::-1]:
			if (i>>k)&1==0:
				if (G-point) <= 100*(k+1)*(X[k][0]-1):
					count += -((-(G-point)) // (100*(k+1)))
					break
				else:
					count = 10**5
					break
	if ans == 0 or count < ans:
		ans = count

print(ans)

# Optimized solution
D,G = list(map(int,input().split()))
X = [list(map(int,input().split())) for _ in range(D)]
ans = 0
 
for i in range(2**D):
	point = 0
	count = 0
	for j in range(D):
		if (i>>j)&1:
			point += 100*(j+1)*X[j][0]+X[j][1]
			count += X[j][0]
	if 	G > point:
		for k in range(D)[::-1]:
			if (i>>k)&1==0:
				if (G-point) <= 100*(k+1)*(X[k][0]):
					count += (G-point-1) // (100*(k+1)) +1
					break
				else:
					count = 10**5
					break
	if ans == 0 or count < ans:
		ans = count
 
print(ans)
# Original solution
from itertools import product
def main():
    d, g = list(map(int, input().split()))
    score_set = []
    score_set_qnum = []
    for i1 in range(1, d + 1):
        kazu, bonus = list(map(int, input().split()))
        score_p = []
        for i2 in range(kazu):
            score_p.append(i1 * 100 * i2)
        score_p.append(i1 * 100 * kazu + bonus)
        score_set.append(score_p)
        score_set_qnum.append(list(range(kazu + 1)))
    score_set_pat = tuple(product(*score_set))
    score_set_qnum_pat = tuple(product(*score_set_qnum))

    inf = float('inf')
    r = inf
    for sset, ssetq in zip(score_set_pat, score_set_qnum_pat):
        sset_sum = sum(sset)
        if sset_sum >= g:
            r = min(r, sum(ssetq))
    print(r)

if __name__ == '__main__':
    main()

# Optimized solution
from itertools import product
from math import ceil
def main():
    d, g = list(map(int, input().split()))
    scoremax_set = []
    numq_set = []
    for i1 in range(1, d + 1):
        kazu, bonus = list(map(int, input().split()))
        scoremax_set.append(i1 * 100 * kazu + bonus)
        numq_set.append(kazu)
    score_get_pat = tuple(product((1,0), repeat=d))

    inf = float('inf')
    r = inf

    for sgpe in score_get_pat:
        score = 0
        q_num = 0
        for j1, s in zip(sgpe, scoremax_set):
            score += j1 * s
        for j2, num in zip(sgpe, numq_set):
            q_num += j2 * num
        if score >= g:
            r = min(r, q_num)
        else:
            sgpe_l = [i for i, x in enumerate(sgpe) if x == 0]
            score_plus = (sgpe_l[-1]+1)*100 * (numq_set[sgpe_l[-1]] - 1)
            if score + score_plus >= g:
                q_num += ceil((g - score) / ((sgpe_l[-1]+1)*100))
                r = min(r, q_num)
    print(r)


if __name__ == '__main__':
    main()
# Original solution
n,k = list(map(int,input().split()))
l = []
for i in range(n):
  array = list(map(int,input().split()))
  line = [int(j)*100*(i+1) for j in range(array[0])]
  line.append(array[0]*100*(i+1)+array[1])
  l.append(line)

chk = []
def f(a,b,c):
  if a==n:
    if b>=k:
      chk.append(c)
      return
  else:
    return [f(a+1,b+l[a][i],c+i) for i in range(len(l[a]))]
f(0,0,0)

print((min(chk)))

# Optimized solution
n,k = list(map(int,input().split()))
l = []
for i in range(n):
  array = list(map(int,input().split()))
  l_append=l.append
  l_append(array)

chk = []
chk_append=chk.append
def f(a,b,c):
  if a==n:
    if b>=k:
      chk_append(c)
      return
  else:
    return [f(a+1,b+100*(a+1)*i,c+i) for i in range(l[a][0])] and f(a+1,b+100*(a+1)*(l[a][0])+l[a][1],c+l[a][0])
  
f(0,0,0)
print((min(chk)))
# Original solution
### ABC104C - All Green
from itertools import permutations


def main():
    D, G = list(map(int, input().split()))
    A = [(0, 0)] + [tuple(map(int, input().split())) for _ in range(D)]
    ans = float("inf")
    for perm in permutations(list(range(1, D + 1)), D):
        cur, cnt = G, 0
        for i in perm:
            point, (num, bonus) = i * 100, A[i]
            if cur / point < num:
                cnt += cur // point
                cur -= point * (cur // point)
            else:
                cnt += num
                cur -= point * num + bonus
            if cur <= 0:
                ans = min(ans, cnt)
                break
    print(ans)


if __name__ == "__main__":
    main()

# Optimized solution
### ABC104C - All Green
def rec(score: int, idx: int) -> int:
    if idx == 0:
        return float("inf")
    point, (num, bonus) = idx * 100, A[idx]
    cnt = min(score // point, num)
    cur_score = cnt * point + bonus if cnt == num else cnt * point
    rest = score - cur_score
    if rest > 0:
        cnt += rec(rest, idx - 1)
    return min(cnt, rec(score, idx - 1))


def main():
    global A
    D, G = list(map(int, input().split()))
    A = [(0, 0)] + [tuple(map(int, input().split())) for _ in range(D)]
    ans = rec(G, D)
    print(ans)


if __name__ == "__main__":
    main()
# Original solution
import sys
sys.setrecursionlimit(2000)

D, goal = list(map(int, input().split()))
q_num, bonus = [], []
for i in range(1,D+1):
  q, b = list(map(int, input().split()))
  q_num.append(q)
  bonus.append(b)
ans = 100000

def rec(comb, next_n, current_score):
  if next_n == D + 1:
    global ans
    if current_score >= goal:
      ans = min(ans, sum(comb))
  else:
    for i in range(q_num[next_n-1]):
      rec(comb + [i], next_n+1, current_score + i * next_n * 100)
    rec(comb + [q_num[next_n-1]], next_n+1, current_score + q_num[next_n-1] * next_n * 100 + bonus[next_n-1])
rec([], 1, 0)

print(ans)

# Optimized solution
import sys
sys.setrecursionlimit(2000)

D, goal = list(map(int, input().split()))
q_num, bonus = [], []
for i in range(1,D+1):
  q, b = list(map(int, input().split()))
  q_num.append(q)
  bonus.append(b)
ans = 100000

def rec2(current_qn, next_n, current_score, tyuuto_done):
  if next_n == D + 1:
    global ans
    if current_score >= goal:
      ans = min(ans, current_qn)
  else:
    rec2(current_qn+q_num[next_n-1], next_n+1, current_score+q_num[next_n-1]*next_n*100+bonus[next_n-1], tyuuto_done)
    rec2(current_qn, next_n+1, current_score, tyuuto_done)
    if not tyuuto_done:
      for i in range(1,q_num[next_n-1]):
        rec2(current_qn+i, next_n+1, current_score+i*next_n*100, 1)

def rec(comb, next_n, current_score):
  if next_n == D + 1:
    global ans
    if current_score >= goal:
      ans = min(ans, sum(comb))
  else:
    for i in range(q_num[next_n-1]):
      rec(comb + [i], next_n+1, current_score + i * next_n * 100)
    rec(comb + [q_num[next_n-1]], next_n+1, current_score + q_num[next_n-1] * next_n * 100 + bonus[next_n-1])

# rec([], 1, 0)
rec2(0, 1, 0, 0)

print(ans)
# Original solution
d, g = list(map(int, input().split()))
test = []
point = []
for i in range(1, d+1):
    p, c = list(map(int, input().split()))
    test.append([p, c])
    point.append([c + (p * i * 100), p])
inf = 10 ** 9
ans = inf
for i in range(2 ** d):
    b = bin(i)[2:]
    b = (d - len(b)) * "0" + b
    temp = 0
    calc = 0
    for j, bb in enumerate(b):
        if bb == "1":
            calc += point[j][0]
            temp += point[j][1]
    if calc >= g:
        ans = min(ans, temp)
    else:
        j_temp = b.rfind("0")
        if (g - calc) <= (test[j_temp][0] - 1) * (j_temp + 1) * 100:
            if (g - calc) % ((j_temp + 1) * 100) == 0:
                ans = min(ans, temp + ((g - calc) // ((j_temp + 1) * 100)))
            else:
                ans = min(ans, temp + ((g - calc) // ((j_temp + 1) * 100)) + 1)
print(ans)

# Optimized solution
d, g = list(map(int, input().split()))
point = []
for i in range(d):
    p, c = list(map(int, input().split()))
    point.append([p, c])

def f(g, i):
    
    if i == -1:
        return 10000000
    n = min(g // ((i + 1) * 100), point[i][0])
    s = n * (i + 1) * 100
    if n == point[i][0]:
        s += point[i][1]
    if s < g:
        n += f(g - s, i - 1)
    return min(n, f(g, i - 1))
print((f(g, d-1)))
# Original solution
def main():

    D, G = list(map(int, input().split()))
    A = []
    for i in range(D):
        p, c = list(map(int, input().split()))
        A.append([i, p, c])
    A = A[::-1]

    cur = [[0, 0]]
    used = [set()]

    for i, p, c in A:
        temp = []
        temp_used = []
        for j in range(len(cur)):
            temp.append(cur[j])
            temp_used.append(used[j])
            temp.append([cur[j][0]+ 100*(i+1)*p+c, cur[j][1] + p])
            temp_used.append(used[j] | {i})
        cur = temp
        used = temp_used
    # 
    # print(cur)
    # print(used)

    ans = float('inf')
    for j in range(len(cur)):
        if cur[j][0] >= G:
            ans = min(ans, cur[j][1])
        else:
            for i, p, c in A:
                if i not in used[j]:
                    if cur[j][0] + 100 * (i+1) * (p-1) < G:
                        cur[j][0] += 100 * (i+1) * (p-1)
                        cur[j][1] += p-1
                    else:
                        if (G - cur[j][0]) % (100*(i+1)) == 0:
                            ans = min(ans, cur[j][1] + (G - cur[j][0]) // (100*(i+1)))
                        else:
                            ans = min(ans, cur[j][1] + (G - cur[j][0]) // (100*(i+1)) + 1)
                        break
    return ans



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

# Optimized solution
def main():

    D, G = list(map(int, input().split()))
    A = []
    for i in range(D):
        p, c = list(map(int, input().split()))
        A.append([i, p, c])
    A = A[::-1]

    hs = [[0, 0, 0]]
    for i, p, c in A:
        temp = []
        for h, v, q in hs: temp.append([h|(1 << i), v+100*(i+1)*p+c, q+p])
        hs += temp

    # print(hs)

    ans = float('inf')
    for h, v, q in hs:
        if v >= G:
            ans = min(ans, q)
        else:
            for i, p, c in A:
                if (h >> i) % 2 == 0:
                    if v + 100*(i+1)*(p-1) < G:
                        v += 100*(i+1)*(p-1)
                        q += p-1
                    else:
                        if (G-v) % (100*(i+1)) == 0:
                            ans = min(ans, q + (G-v) // (100*(i+1)))
                        else:
                            ans = min(ans, q + 1 + (G-v) // (100*(i+1)))
                        break
    return ans

if __name__ == '__main__':
    print((main()))
# Original solution
import math

D,G = list(map(int,input().split()))
p = []
c = []
for i in range(D):
        p_tmp,c_tmp = list(map(int,input().split()))
        p.append(p_tmp)
        c.append(c_tmp)

ans = sum(p)
for i in range(D):
        for j in range(p[i]):
                for k in range(2**D-1):
                        score = (i+1)*100*j
                        ans_tmp = j
                        for l in range(D):
                                if l == i:
                                        continue
                                elif (k>>l)%2 == 1:
                                        score += (l+1)*100*p[l]+c[l]
                                        ans_tmp += p[l]
                        if score >= G:
                                ans = min(ans,ans_tmp)

print(ans)

# Optimized solution
import math
D,G = list(map(int,input().split()))
p=[]
c=[]
for i in range(D):
    p_tmp,c_tmp = list(map(int,input().split()))
    p.append(p_tmp)
    c.append(c_tmp)

ans = sum(p)
for i in range(2**D):
    score_tmp = 0
    ans_tmp = 0
    for j in range(D):
        if (i>>j)%2 == 1:
            score_tmp += p[j]*(j+1)*100+c[j]
            ans_tmp += p[j]

    if ans_tmp >= ans:
        continue
    elif score_tmp >= G:
        ans = ans_tmp
        continue
    else:
        for j in range(D):
            if (i>>(D-1-j))%2 == 1:
                continue
            elif score_tmp + p[D-1-j]*(D-j)*100 < G:
                break
            else:
                ans_tmp += math.ceil((G - score_tmp)/((D-j)*100))
                ans = min(ans,ans_tmp)
                break

print(ans)
# Original solution
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

D, G = na()
p = []
c = []
for i in range(D):
    x, y = na()
    p.append(x)
    c.append(y)

ans = 99999999
for i in range(1<<D):
    ct = 0
    score = 0
    for j in range(D):
        if i>>j&1:
            score += c[j]
            score += p[j] * (j+1) * 100
            ct += p[j]
    while score < G:
        for j in range(D-1, -1, -1):
            if i>>j&1: continue
            for k in range(p[j]):
                if score < G:
                    score += (j+1)*100
                    ct += 1
    ans = min(ans, ct)
print(ans)


# Optimized solution
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

D, G = na()
p = []
c = []
for i in range(D):
    x, y = na()
    p.append(x)
    c.append(y)

ans = 99999999
for i in range(1<<D):
    ct = 0
    score = 0
    for j in range(D):
        if i>>j&1:
            score += c[j]
            score += p[j] * (j+1) * 100
            ct += p[j]
    for j in range(D-1, -1, -1):
        if i>>j&1: continue
        if score >= G: break
        g = (j+1)*100
        got = (G-score+g-1)//g
        score += min(got, p[j]) * g
        ct += min(got, p[j])
    ans = min(ans, ct)
print(ans)
# Original solution
d , g = list(map(int, input().split()))
pc = [list(map(int, input().split()))for i in range(d)]
x=[]
y=[0]*d
ac=[0]*d
for i in range(d):
    ac[i]=pc[i][0]*(i+1)*100+pc[i][1]

def dfs(n,m,y,now):
    if now==n:
        z=y.copy()
        x.append(z)
        return
    for i in range(m):
        y[now]=i
        dfs(n,m,y,now+1)
dfs(d,3,y,0)

mi = 1000
for i in x:
    sum = 0
    cost = 0
    stock = []
    sum2 = 0
    for j in range(d):
        if i[j]==1:
            sum+=ac[j]
            cost+=pc[j][0]
            sum2+=ac[j]
        if i[j]==2:
            stock+=[(j+1)*100]*pc[j][0]
            sum2+=ac[j]
    if sum2<g:
        continue
    stock.sort()
    while sum<g and stock:
        sum+=stock.pop()
        cost+=1
    if sum>=g:
        mi=min(mi,cost)

print(mi)


# Optimized solution
d , g = list(map(int, input().split()))
pc = [list(map(int, input().split()))for i in range(d)]
x=[]
y=[0]*d
ac=[0]*d
for i in range(d):
    ac[i]=pc[i][0]*(i+1)*100+pc[i][1]

def dfs(n,m,y,now):
    if now==n:
        z=y.copy()
        x.append(z)
        return
    for i in range(m):
        y[now]=i
        dfs(n,m,y,now+1)
dfs(d,3,y,0)
mi = 1000
for i in x:
    sum = 0
    cost = 0
    stock = []
    sum2 = 0
    cost2 = 0
    for j in range(d):
        if i[j]==1:
            sum+=ac[j]
            cost+=pc[j][0]
            sum2+=ac[j]
            cost2+=pc[j][0]
        if i[j]==2:
            stock+=[(j+1)*100]*pc[j][0]
            sum2+=pc[j][0]*(j+1)*100
            cost2+=pc[j][0]
    if sum2<g:
        continue
    stock.sort()
    if abs(sum2-g)>abs(sum-g):
        while sum<g and stock:
            sum+=stock.pop()
            cost+=1
        if sum>=g:
            mi=min(mi,cost)
    else:
        while sum2>g and stock:
            sum2-=stock.pop()
            cost2-=1
        cost+=1
        mi=min(mi,cost2)

print(mi)
# Original solution
import itertools
n, g = list(map(int, input().split()))
L = []
for i in range(n):
    t = list(map(int, input().split()))
    # 得点の情報を追加
    t.append((i+1)*100)
    L.append(t)

ans = 100 * n
for v in itertools.permutations(L):
    # print(v)
    score = 0
    count = 0
    k = 0
    p = v[k][0]
    while score < g:
        score += v[k][2]
        p -= 1
        count += 1
        if p == 0:
            score += v[k][1]
            k += 1
            if k < n:
                p = v[k][0]
        # print(v,count,score,k,p)
    ans = min(ans, count)
print(ans)

# ミス
# P = []
# G = []
# for i in range(n):
#     s, t = map(int, input().split())
#     P.insert(0, s)
#     G.insert(0, t//100)
# score = 0
# k = 0
# count = 0
# while score < g:
#     count += 1
#     if 1 in P:
#         j = P.index(1)
#         score += n-j + G[j]
#         P[j] = 0
#         if j == k:
#             k += 1
#     else:
#         score += n-k
#         P[k] -= 1
#     print(P,G,score,count,k)
# print(count)

# Optimized solution
import itertools
n, g = list(map(int, input().split()))
L = []
for i in range(n):
    t = list(map(int, input().split()))
    # 配点
    t.append((i+1)*100)
    # この配点の問題を全部解いた時の得点
    t.append((i+1)*100*t[0]+t[1])
    L.append(t)
# print(L)

ans = g//100
# https://img.atcoder.jp/abc104/editorial.pdf bit全探索
for i in range(2**n):
    count = 0
    score = 0
    m = 0
    for j in range(n):
        if (i >> j) & 1:
            score += L[j][3]
            count += L[j][0]
        else:
            m = j
    # print(bin(i), m, score, count)
    if score >= g:
        ans = min(ans, count)
    else: # 解いていない配点の問題の中で一番配点が高いもの
        if (g - score)/L[m][2] <= L[m][0] and (g - score)%L[m][2] == 0:
            count += (g - score)//L[m][2]
        elif (g - score)/L[m][2] + 1 <= L[m][0]:
            count += ((g - score)//L[m][2])+1
        else:
            count = g//100
        ans = min(ans, count)
    # print(bin(i), m, L[m], score, count)
print(ans)

# 全探索したら時間超過
# ans = 100 * n
# for v in itertools.permutations(L):
#     score = 0
#     count = 0
#     k = 0
#     p = v[k][0]
#     while score < g:
#         score += v[k][2]
#         p -= 1
#         count += 1
#         if p == 0:
#             score += v[k][1]
#             k += 1
#             if k < n:
#                 p = v[k][0]
#     ans = min(ans, count)
# print(ans)

# DPっぽく解こうとしたけど失敗
# P = []
# G = []
# for i in range(n):
#     s, t = map(int, input().split())
#     P.insert(0, s)
#     G.insert(0, t//100)
# score = 0
# k = 0
# count = 0
# while score < g:
#     count += 1
#     if 1 in P:
#         j = P.index(1)
#         score += n-j + G[j]
#         P[j] = 0
#         if j == k:
#             k += 1
#     else:
#         score += n-k
#         P[k] -= 1
#     print(P,G,score,count,k)
# print(count)