Scanf.scanf "%d %d" @@ fun d g ->
  let a = Array.init d (fun i ->
    Scanf.scanf " %d %d" (fun p c->((i+1)*100,p,c))) in
  let ls = a |> Array.fold_left (fun l (i,p,c) ->
    List.fold_left (fun l (isum,psum)->
      ((Array.init (p+1) (fun pi -> isum+pi,psum+pi*i+if pi=p then c else 0)) |> Array.to_list) @ l
    ) [] l
  ) [0,0] in
  let ls = List.filter(fun (i,p) -> p>= g) ls in
  let ls = List.sort compare ls in
  ls |> List.iter (fun (i,p)->Printf.printf "%d\n" i;exit 0)
