output_description: Print the minimum number of problems that needs to be solved in order to have
  a total score of G or more points. Note that this objective is always
  achievable (see Constraints).
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      D G
      p_1 c_1
      :
      p_D c_D
attempt: import sys
  from collections import deque
  import copy
  
  sys.setrecursionlimit(4100000)
  
  
  def inputs(num_of_input):
      ins = [input() for i in range(num_of_input)]
      return ins
  
  
  def solve(D, G, inputs):
      problems = list(map(string_to_int, inputs))
      binary_max = 2 ** len(problems)
  
      min_num = -1
      for pattern in range(0, binary_max):
          binary_pattern = bin(pattern)[2:]
          while len(binary_pattern) != D:
              binary_pattern = "0" + binary_pattern
  
          incompleted_problem = -1
          count_num = 0
          count_score = 0
  
          for i in reversed(range(len(binary_pattern))):
              if binary_pattern[i] == "1":
                  count_num += problems[i][0]
                  count_score += (100 * (i + 1)) * problems[i][0] + problems[i][1]
              elif incompleted_problem == -1 and binary_pattern[i] == "0":
                  incompleted_problem = i
  
          if incompleted_problem != -1:
              for _ in range(problems[incompleted_problem][0]):
                  if count_score >= G:
                      break
                  count_num += 1
                  count_score += 100 * (incompleted_problem + 1)
          if count_score >= G and (min_num == -1 or count_num < min_num):
              min_num = count_num
      return min_num
  
  
  def string_to_int(string):
      return list(map(int, string.split()))
  
  
  if __name__ == "__main__":
      [D, G] = string_to_int(input())
      ret = solve(D, G, inputs(D))
      print(ret)
  
problem_description: Statement
  
  A programming competition site _AtCode_ provides algorithmic problems. Each
  problem is allocated a score based on its difficulty. Currently, for each
  integer i between 1 and D (inclusive), there are p_i problems with a score of
  100i points. These p_1 + … + p_D problems are all of the problems available on
  AtCode.
  
  A user of AtCode has a value called _total score_. The total score of a user
  is the sum of the following two elements:
  
    * Base score: the sum of the scores of all problems solved by the user.
    * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).
  
  Takahashi, who is the new user of AtCode, has not solved any problem. His
  objective is to have a total score of G or more points. At least how many
  problems does he need to solve for this objective?
samples: [{"input": "2 700\n    3 500\n    5 800", "output": "3\n    \n\nIn this case, there are three problems each with 100 points and five problems\neach with 200 points. The perfect bonus for solving all the 100-point problems\nis 500 points, and the perfect bonus for solving all the 200-point problems is\n800 points. Takahashi's objective is to have a total score of 700 points or\nmore.\n\nOne way to achieve this objective is to solve four 200-point problems and earn\na base score of 800 points. However, if we solve three 100-point problems, we\ncan earn the perfect bonus of 500 points in addition to the base score of 300\npoints, for a total score of 800 points, and we can achieve the objective with\nfewer problems.\n\n* * *"}, {"input": "2 2000\n    3 500\n    5 800", "output": "7\n    \n\nThis case is similar to Sample Input 1, but the Takahashi's objective this\ntime is 2000 points or more. In this case, we inevitably need to solve all\nfive 200-point problems, and by solving two 100-point problems additionally we\nhave the total score of 2000 points.\n\n* * *"}, {"input": "2 400\n    3 500\n    5 800", "output": "2\n    \n\nThis case is again similar to Sample Input 1, but the Takahashi's objective\nthis time is 400 points or more. In this case, we only need to solve two\n200-point problems to achieve the objective.\n\n* * *"}, {"input": "5 25000\n    20 1000\n    40 1000\n    50 1000\n    30 1000\n    1 1000", "output": "66\n    \n\nThere is only one 500-point problem, but the perfect bonus can be earned even\nin such a case."}]