Problem:
Score : 300 points

Problem 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?

Constraints

1 ≤ D ≤ 10

1 ≤ p_i ≤ 100

100 ≤ c_i ≤ 10^6

100 ≤ G

All values in input are integers.

c_i and G are all multiples of 100.

It is possible to have a total score of G or more points.

Input

Input is given from Standard Input in the following format:

D G
p_1 c_1
:
p_D c_D

Output

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).

Sample Input 1

2 700
3 500
5 800

Sample Output 1

3

In this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.

One way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.

Sample Input 2

2 2000
3 500
5 800

Sample Output 2

7

This case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.

Sample Input 3

2 400
3 500
5 800

Sample Output 3

2

This case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.

Sample Input 4

5 25000
20 1000
40 1000
50 1000
30 1000
1 1000

Sample Output 4

66

There is only one 500-point problem, but the perfect bonus can be earned even in such a case.

Solution in Rust (1.15.1) (judge verdict: Accepted)

use std::io;
//use std::collections::HashMap;
//use std::collections::BinaryHeap;
//use std::collections::HashSet;
//use std::mem; // mem::swap(&mut x,&mut y);
use std::cmp; // cmp::max,cmp::min

// Rust memo: https://hackmd.io/i0lQY1OKTDW1t66TECOmiw?both

#[allow(dead_code)]
fn read_line() -> String{
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
fn read_charvec() -> Vec<char>{
    read_line().chars().collect()
}

#[allow(dead_code)]
fn read_ints() -> Vec<i64>{
    let s = read_line();
    let split:Vec<&str> = s.split(" ").collect();
    split.iter().map(|&x| x.to_string().parse().unwrap()).collect()
}

#[allow(dead_code)]
fn read_int() -> i64{
    read_ints()[0]
}

#[allow(dead_code)]
fn reverse(s: &String) -> String{
    s.chars().rev().collect::<String>()
}

#[allow(dead_code)]
fn read_lines(n:i64) -> Vec<String>{
    let mut xs = Vec::new();

    for _i in 0..n{
        xs.push(read_line());
    }

    xs
}

#[allow(dead_code)]
fn read_ints2(n:i64) -> Vec<i64>{
    read_lines(n).iter().map(|x| x.parse().unwrap()).collect()
}

#[allow(dead_code)]
fn arange(start:i64,end:i64,step:i64) -> Vec<i64>{
    let mut ret = Vec::new();
    let mut i = start;

    while i < end{
        ret.push(i);
        i += step;
    }

    ret
}

#[allow(dead_code)]
const DXS : [i64; 4] = [0,0,1,-1];
#[allow(dead_code)]
const DYS : [i64; 4]  = [1,-1,0,0];
#[allow(dead_code)]
const INF : i64 = 999999999;

////////////////////////////////////////////////

#[derive(Clone,Debug)]
struct Quiz{
    n_point : i64,
    n_quiz : i64,
    n_bonus : i64,
}
/*
fn solve(xs:Vec<Quiz>,g:i64){
    println!("{}",m);
}*/

fn solve(xs:Vec<Quiz>,g:i64)->i64{
    let mut m = 999999999999;
    
    for i in  0..(1<<xs.len()){
        let mut rest = g;
        let mut count = 0;
        
        // 全解き
        for j in 0..xs.len(){
            if (i >> j)&1 == 0{
                continue;
            }
            rest -= xs[j].n_point * xs[j].n_quiz + xs[j].n_bonus;
            count += xs[j].n_quiz;
        }
        
        // 少しだけ解く
        for j in 0..xs.len(){
            if rest <= 0{
                break;
            }
            // すでに解いてるやつはとかない(解けない)
            if (i >> j)&1 != 0{
                continue;
            }else if rest <= xs[j].n_point * xs[j].n_quiz{
                // 幾つかとけばよい
                let u = (rest + xs[j].n_point - 1)/xs[j].n_point;
                count += u;
                rest -= u * xs[j].n_point;
                break;
            }else{
                // 全部解かねばならない
                rest -= xs[j].n_point * xs[j].n_quiz + xs[j].n_bonus;
                count += xs[j].n_quiz;
            }
        }
        
        if rest<=0{
            m = cmp::min(m,count);
        }
    }
    
    m
}

/*
fn solve(mut xs:Vec<Quiz>,g:i64)->i64{
    let ys = xs.iter()
        .map(|x| (x.n_point * x.n_quiz + x.n_bonus) as f64 / (x.n_quiz as f64))
        .collect::<Vec<f64>>();
    let zs = xs.iter()
        .map(|x| (x.n_point * x.n_quiz + x.n_bonus))
        .collect::<Vec<i64>>();
    let max_idx = {
        let mut idx = 0;
        for i in 0..ys.len(){
            if ys[idx] <= ys[i]{
                idx = i;
            }
        }
        idx 
    };
    
    if g > zs[max_idx]{
        let n_solved = xs[max_idx].n_quiz;
        println!("we solved {:?}",xs[max_idx]);
        xs.remove(max_idx);
        
        n_solved + solve(xs,g-zs[max_idx])
    }else{
        let mut m = 999999999;
        
        for i in  0..(1<<xs.len()){
            let mut sum = g;
            let mut n_solved = 0;
            
            for j in 0..xs.len(){
                if (i >> j)&1 == 0{
                    continue;
                }
                
                if sum < xs[j].n_point * xs[j].n_quiz{
                    // 何個か解けばよいだけ
                    let n_s = sum / xs[j].n_point;
                    
                    n_solved += n_s;
                    sum -= n_s * xs[j].n_point;
                    
                    if sum <= 0{
                        n_solved += 1;
                        sum -= xs[j].n_point;
                    }
                }else{
                    // 全部とけば良い
                    sum -= xs[j].n_point * xs[j].n_quiz + xs[j].n_bonus;
                    n_solved += xs[j].n_quiz;
                }
                
                if sum <= 0{
                    m = cmp::min(n_solved,m);
                    break;
                }
            }
        }
        
        m
    }
}*/

fn main(){
    let inputs = read_ints();
    let (d,g) = (inputs[0] as usize,inputs[1]);
    
    let mut xs = (0..d)
        .map(|i| (i,read_ints()) )
        .map(|p| Quiz{
            n_point:p.0 as i64 * 100+100,
            n_quiz:p.1[0],
            n_bonus:p.1[1]
        })
        .collect::<Vec<Quiz>>();
    
    xs.reverse();
    //println!("{:?}",xs);
    
    println!("{}",solve(xs,g));
}