jiahuimbzuai/CoQuIR huggingface dataset:
//  [c]
#include <stdio.h>

long long int gcd(long long int x,long long int y)
{
	if(x<y)return gcd(y,x);
	else if(y==0)return x;
	else return ((y>=(x-y)) ? gcd(y,(x-y)) : gcd((x-y),y));
}


int main()
{
	long long int a,b,c,d,g,lcm;
	long long int n,m,o=0;
	//nは[a,b]区間中のcで割り切れる整数の個数
	//mは[a,b]区間中のdで割り切れる整数の個数
	
	scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
	a--;
	g=gcd(c,d);
	n=(b/c)-(a/c);
	m=(b/d)-(a/d);
	
	lcm=c*d/g;
	o=(b/lcm)-(a/lcm);
	
	//printf("%lld,%lld,%lld,%lld\n",lcm,n,m,o);
	printf("%lld",((b-a)-n-m+o));
	return 0;
}
//  [c]
#include <stdio.h>

long long int gcd(long long int x, long long int y){
    if(x == y){return x;}
    else if(x > y){return gcd(x-y, y);}
    else{return gcd(x, y-x);}
}

long long int lcm(long long int x, long long int y){
    return x*y/gcd(x, y);
}

int main(void) {
    long long int a, b, c, d, i;
    scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
    long long int x = lcm(c, d);
    long long int ans = (b-(a-1)) - (b/c - (a-1)/c) - (b/d - (a-1)/d) + (b/x - (a-1)/x);
    printf("%lld\n", ans);
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

#define ll long long

void swap (int *x, int *y) {
  int temp;

  temp = *x;
  *x = *y;
  *y = temp;

  return;
}


long int gcd(long int a, long int b){
  long int c;

  while (b > 0){
    c = a % b;
    a = b;
    b = c;
  }

  return a;
}

int upll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;
}

int downll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;
}

void sortup(ll*a,int n){
  qsort(a,n,sizeof(ll),upll);
}

void sortdown(ll*a,int n){
  qsort(a,n,sizeof(ll),downll);
}

long int modpow(long int a,long int n,long int mod){
  long int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}


int main(void){
  long int a,b;
  long int c,d;
  scanf("%ld%ld%ld%ld",&a,&b,&c,&d);
  long int dif=b-a,pro=0;
  if(a%c!=0&&a%d!=0){
    dif++;
  }
  pro+=(b/c)-(a/c);
  pro+=(b/d)-(a/d);
  long int g=0;
  if(gcd(c,d)==1){
    g=c*d;
  }else{
    for(int i=1;i<c*d;i++){
      if(c*i%d==0){
        g=c*i;
        break;
      }
    }
  }
  pro-=(b/g)-(a/g);
  printf("%ld\n",dif-pro);
  return 0;
}
//  [javascript]
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function () { return this.index < this.max },
        "next": function () { if (!this.hasNext()) { throw "ArrayIndexOutOfBoundsException"; } else { return this.list[this.index++]; } }
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const euc = (x, y) => {
    if (x == 0) return y
    if (y == 0) return x
    if (x > y) {
        return euc(x % y, y)
    } else {
        return euc(y % x, x)
    }
}
const Main = () => {
    const [A, B, C, D] = next().split(" ").map(el => BigInt(el))
    //B
    let bc = B / C
    let bd = B / D
    let min = C * D / euc(C, D)
    let bcd = B / min
    let b = B - bc - bd + bcd
    //A
    let ac = (A-1n) / C
    let ad = (A-1n) / D
    let acd = (A-1n) / min
    let a = A-1n - ac - ad + acd

    console.log(String(b-a))
}
Main()
//  [go]
package main

import "fmt"

var (
	finv, inv, fac [MAX]int
)

func COM(n, k int) int {
	if n < k {
		return 0
	}
	if n < 0 || k < 0 {
		return 0
	}
	return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD
}

func init() {
	fac[0] = 1
	fac[1] = 1
	finv[0] = 1
	finv[1] = 1
	inv[1] = 1
	for i := 2; i < MAX; i++ {
		fac[i] = fac[i-1] * i % MOD
		inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD
		finv[i] = finv[i-1] * inv[i] % MOD
	}
}

const (
	MOD = 1000000007
	MAX = 510000
)

func ModAdd(a, b int64) int64 {
	return (a + b) % MOD
}

func ModMul(a, b int64) int64 {
	return a * b % MOD
}

func ModSub(a, b int64) int64 {
	r := (a%MOD - b%MOD) % MOD
	if r < 0 {
		r += MOD
	}
	return r
}

func ModDiv(a, b int64) int64 {
	return a % MOD * ModInv(b) % MOD
}

func ModPow(a, n int64) int64 {
	var r int64 = 1
	for n > 0 {
		if n&1 == 1 {
			r = r * a % MOD
		}
		a = a * a % MOD
		n >>= 1
	}
	return r
}

func ModInv(a int64) int64 {
	var b, u, v int64 = MOD, 1, 0
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= MOD
	if u < 0 {
		u += MOD
	}
	return u
}

type Q struct {
	idx, value int
	a, b       int
	index      int
}

type QS []*Q

func (p QS) Len() int           { return len(p) }
func (p QS) Less(i, j int) bool { return p[i].value > p[j].value }
func (pq QS) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *QS) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Q)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *QS) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}

func FactoredPrimeNumber(num int) map[int]int {
	m := map[int]int{}
	return factor(m, num, 2)
}

func factor(result map[int]int, num, pnum int) map[int]int {
	if pnum*pnum > num {
		if num != 1 {
			result[num] += 1
		}
		return result
	}

	if num%pnum == 0 {
		num /= pnum
		result[pnum]++
	} else {
		pnum++
	}
	return factor(result, num, pnum)
}

func GCD(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return GCD(b, a%b)
}

func LCM(a, b int64) int64 {
	return a * b / GCD(a, b)
}

type Po struct {
	i       int
	cnt     int
	counter int
}

func main() {
	var A, B, C, D int64
	fmt.Scanf("%d %d %d %d\n", &A, &B, &C, &D)

	lcm := LCM(C, D)
	L := B - (B/C + B/D - B/lcm)
	R := (A - 1) - ((A-1)/C + (A-1)/D - (A-1)/lcm)
	fmt.Println(L - R)

}

func Reverse(runes []rune) []rune {
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return runes
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	A, B, C, D := ReadInt(), ReadInt(), ReadInt(), ReadInt()
	fmt.Println(B - A + 1 - (g(A, B, C) + g(A, B, D) - g(A, B, LCM(C, D))))
}

func f(n, x int) int {
	return (n-1)/x + 1
}

func g(A, B, x int) int {
	return f(B+1, x) - f(A, x)
}

func LCM(a, b int) int {
	return a / GCD(a, b) * b
}
func GCD(a, b int) int {
	if b == 0 {
		return a
	}
	return GCD(b, a%b)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}
//  [go]
package main

import (
	"fmt"
)

func main() {

	var a,b,c,d int
	fmt.Scan(&a, &b, &c, &d)

	ans := f(b, c, d) - f(a-1, c, d)
	fmt.Println(ans)

}

func f(x, c, d int) int {
	res := x
	res -= x/c
	res -= x/d
	res += x/lcm(c,d)
	return res
}

func gcd(a, b int) int {
	if a > b {
		return gcd(b, a)
	}
	for a != 0 {
		a, b = b % a, a
	}
	return b
}
func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
//  [ruby]
a, b, c, d = gets.split.map(&:to_i)

lcm = c.lcm(d)

a_lt = (a - 1) / c + (a - 1) / d - (a - 1) / lcm
b_lte = b / c + b / d - b / lcm
a_gte_b_lte = b_lte - a_lt

p b - a - a_gte_b_lte + 1
//  [ruby]
a, b, c, d = gets.strip.split.map(&:to_i)

def count(x, y, d)
  i = (x - 1) / d
  j = y / d
  
  (j - i)
end

ans = (b - a + 1) - count(a, b, c) - count(a, b, d) + count(a, b, c.lcm(d))
puts(ans)
//  [ruby]
a, b, c, d = gets.split(" ").map(&:to_i)
def gcd(c, d)
	return d==0 ? c : gcd(d, c%d)
end
def lcm(c, d)
	return c/gcd(c, d) * d
end
def func(x, c, d)
	return ret = x - x/c - x/d + x/lcm(c, d)
end
ans = func(b, c, d) - func(a-1, c, d)
puts ans
//  [rust]
fn main() {
    let mut reader = acio::Reader::new();
    let a = reader.read::<u64>() - 1;
    let b = reader.read::<u64>();
    let c = reader.read::<u64>();
    let d = reader.read::<u64>();
    let l = acbat::lcm(c, d);
    let f = |x| x - x / c - x / d + 1;
    let k = f(l);
    let ad = f(a % l);
    let bd = f(b % l);
    let ac = (a / l * k) + ad;
    let bc = (b / l * k) + bd;
    //println!("{} / {} + {}, {}", k, l, ad, bd);
    //println!("{} - {} = {}", bc, ac, bc - ac);
    println!("{}", bc - ac);
}

/// Batteries for AtCoder
#[allow(dead_code)]
mod acbat {
    pub fn lcm(v1: u64, v2: u64) -> u64 {
        v1 * v2 / gcd(v1, v2)
    }

    pub fn gcd(v1: u64, v2: u64) -> u64 {
        if v1 == v2 {
            v1
        } else if v1 < v2 {
            gcd(v1, v2 - v1)
        } else {
            gcd(v1 - v2, v1)
        }
    }
}

/// IO Module for AtCoder
#[allow(dead_code)]
mod acio {
    use std::fmt::Debug;
    use std::io::{stdin, Stdin};
    use std::str::FromStr;

    pub struct Reader {
        input: Stdin,
        stack: Vec<String>,
    }

    impl Reader {
        pub fn new() -> Self {
            Reader {
                input: stdin(),
                stack: vec![],
            }
        }

        pub fn read_by<F>(&mut self, count: u64) -> Vec<F>
        where
            F: FromStr,
            <F as FromStr>::Err: Debug,
        {
            let mut v = vec![];
            for _ in 0..count {
                v.push(self.read());
            }
            return v;
        }

        pub fn read<F>(&mut self) -> F
        where
            F: FromStr,
            <F as FromStr>::Err: Debug,
        {
            if self.stack.is_empty() {
                let mut line = self.read_line();
                self.stack.append(&mut line);
                self.stack.reverse();
            }
            self.stack.pop().unwrap().parse().unwrap()
        }

        fn read_line(&mut self) -> Vec<String> {
            let mut buf = String::new();
            self.input.read_line(&mut buf).unwrap();
            buf.split_whitespace().map(|s| s.to_string()).collect()
        }
    }
}
//  [rust]
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a:usize = read();
    let b:usize = read();
    let c:usize = read();
    let d:usize = read();
    println!("{}", num(b, c, d) - num(a-1, c, d));
}

fn gcd(x:usize, y:usize) -> usize {
    if y == 0 {
        return x;
    }
    return gcd(y, x%y)
}

fn num(n:usize, c:usize, d:usize) -> usize {
    let lcm = c / gcd(c, d) * d;
    return n - n / c - n / d + n / lcm
}
//  [rust]
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a:usize = read();
    let b:usize = read();
    let c:usize = read();
    let d:usize = read();
    println!("{}", num(b, c, d) - num(a-1, c, d));
}

fn gcd(a:usize, b:usize) -> usize {
    if b == 0 {
        return a
    }
    return gcd(b, a%b)
}

fn num(a:usize, b:usize, c:usize) -> usize {
    let lcm = b / gcd(b, c) * c;
    return a - a/b - a / c + a / lcm
}
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}
///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }
    
    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = index(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let abcd = readInts()
    let (a, b, c, d) = (abcd[0] - 1,abcd[1],abcd[2],abcd[3])
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    
    var N = b - a
    N   -= b / c - a / c + b / d - a / d
    N   += b / lcm(c, d) - a / lcm(c, d)
    print(N)
}
main()
//  [swift]
func gcd(_ a: Int, _ b: Int) -> Int {
  if b == 0 {
    return a
  }
  return gcd(b, a % b)
}

let input = readLine()!.split(separator: " ").map { Int($0)! }
let a = input[0] - 1
let b = input[1]
let c = input[2]
let d = input[3]

let lcm = c * d / gcd(c, d)

let canDivides = b / c - a / c + b / d - a / d - (b / (lcm) - a / (lcm))
print(b - a - canDivides)
//  [python]
D, G=list(map(int, input().split()))
PC=[0]+[list(map(int, input().split())) for _ in range(D)]

def function(G, i):
	if i==0:
		return 1e9
	n=min(G//(i*100), PC[i][0])
	s=n*i*100
	if n==PC[i][0]:
		s+=PC[i][1]
	if s<G:
		n+=function(G-s, i-1)
	return min(n, function(G,i-1))
print(function(G, D))
//  [python]
D,G=map(int, input().split())
PC=[0]+[list(map(int, input().split())) for _ in range(D)]
def function(G,i):
    if i==0:
        return 1e9
    n=min(G//(i*100),PC[i][0]) #determin the number of "100i problem" to be solved
    s=n*i*100
    if n==PC[i][0]:
        s+=PC[i][1] #modify the point for "100i problem" with complete bonus
    if s<G:
        n+=function(G-s,i-1) #calculate until G-Sigma(s)=0
    return min(n,function(G,i-1))
print(function(G,D))
//  [python]
d,g=map(int,input().split())

p=[]
c=[]

for i in range(d):
    a,b=map(int,input().split())
    p.append(a)
    c.append(b)
    
sum=[]
for i in range(d):
    sum.append((i+1)*100*p[i]+c[i])


def ans(g,t):
    if t<=0:
        return 100000000000
    n=min(int(g/(100*t)),p[t-1])
    s=100*t*n
    
    if n==p[t-1]:
        s=sum[t-1]
    if g>s:
        n+=ans(g-s,t-1)
    
    return min(n,ans(g,t-1))

print(ans(g,d))
//  [python]
import itertools
d,g=map(int,input().split())
p=[]
c=[]
for i in range(d):
    p1,c1=map(int,input().split())
    p.append(p1)
    c.append(c1//100)
n=list(itertools.permutations(list(range(1,d+1))))
ans=1024
g//=100
for i in range(len(n)):
    cnt=g
    cnt2=0
    for j in range(d):
        num3=n[i][j]
        num4=num3*p[num3-1]
        if num4>=cnt:
            cnt2+=((cnt-1)//num3)+1
            break
        elif num4+c[num3-1]>=cnt:
            cnt2+=p[num3-1]
            break
        else:
            cnt-=num4+c[num3-1]
            cnt2+=p[num3-1]
    ans=min(ans,cnt2)
print(ans)
//  [python]
import numpy as np
d, g = map(int, input().split())
p = []
c = []
for _ in range(d):
    _p, _c = map(int, input().split())
    p.append(_p)
    c.append(_c)

s = np.arange(1, d + 1) * 100
p = np.array(p)

ans_list = []

bool_list = [False] * d

state_list = []

def dfs(i, n, bool_list):
    bool_list = bool_list.copy()
    if i == n:
        state_list.append(bool_list)
    else:
        dfs(i + 1, n, bool_list)
        bool_list[i] = True
        dfs(i + 1, n, bool_list)

dfs(0, d, bool_list)

for state in state_list:
    if np.dot(s * p, state) + np.dot(c, state) >= g:
        ans_list.append(np.dot(p, state))
    else:
        score = max(s * np.array([not i for i in state]))
        for j in range(1, p[score//100 - 1] + 1):
            if np.dot(s * p, state) + np.dot(c, state) + score * j >= g:
                ans_list.append(np.dot(p, state) + j)

print(min(ans_list))
//  [python]
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

D,G = II()
p,c = Line(D)

def dfs(point,p):
    if point<=0:
        return 0
    else:
        ret = []
        for i in range(D):
            if p[i]==0:
                continue
            q,mod = divmod(point,(i+1)*100)
            if mod ==0:
                num = q
            else:
                num = q+1
            if num <= p[i]:
                ret.append(num)
            else:
                temp = p[i]
                p[i] = 0
                ret.append(dfs(point-100*(i+1)*temp-c[i],p)+temp)
                p[i] = temp
        return min(ret)

print(dfs(G,p))
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int d = Integer.parseInt(str[0]);
		int g = Integer.parseInt(str[1]);

		int p[] = new int[d];
		int c[] = new int[d];

		for (int i = 0; i < d; i++) {
			str = br.readLine().split(" ");

			p[i] = Integer.parseInt(str[0]);
			c[i] = Integer.parseInt(str[1]);
		}

		int ans = Integer.MAX_VALUE;
		for (int bit = 0; bit < (1 << d); bit++) {
			int problem = 0;
			int point = 0;

			for (int i = 0; i < d; i++) {
				if ((bit & (1 << i)) != 0) {
					problem += p[i];
					point += (1 + i) * 100 * p[i] + c[i];
				}
			}
			if (point >= g) {
				ans = Math.min(ans, problem);
				continue;
			}
			for (int i = 0; i < d; i++) {
				if ((bit & (1 << i)) != 0)
					continue;
				if ((g - point) / ((i + 1) * 100) <= p[i]) {
					problem += (g - point) / ((i + 1) * 100);
					ans = Math.min(ans, problem);
				}
			}
		}
		System.out.println(ans);
	}
}
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) {

    new Main().run();
  }

  public void run() {
    
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      String[] lines = in.readLine().split(" ");
      int n = Integer.parseInt(lines[0]);
      int target = Integer.parseInt(lines[1]);

      int[] p = new int[n];
      int[] c = new int[n];
      
      for(int i=0; i<n; i++) {
        lines = in.readLine().split(" ");
        p[i] = Integer.parseInt(lines[0]);
        c[i] = Integer.parseInt(lines[1]);
      }

      int ans = Integer.MAX_VALUE;
      for(int bits=0; bits < (1<<n); bits++){
        int score = 0, cnt = 0, restMax = -1;

        for(int i=0; i<n; i++) {
          if((bits>>i & 1) == 1) {
            score += 100 * (i+1) * p[i] + c[i];
            cnt += p[i];
          }
          else {
            restMax = i;
          }
        }
        // System.out.println(
        //   Integer.toBinaryString(bits) + ":" + score + "," + cnt);

        if(score < target) {
          int point = 100 * (restMax+1);
          int add = (target - score + (point-1)) / point;

          if(add >= p[restMax])
            continue;

          cnt += add;
        }

        ans = Math.min(ans, cnt);
      }

      System.out.println(ans);
    }
    catch(IOException e) {
      System.out.println(e);
    }
  }
}
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] dg = br.readLine().split(" ");
		int d = Integer.parseInt(dg[0]);
		int g = Integer.parseInt(dg[1]);

		HashMap<Integer, String[]> map = new HashMap<Integer, String[]>();
		for (int i = 0; i < d; i++) {
			map.put(new Integer((i + 1) * 100), br.readLine().split(" "));
		}

		AtomicInteger min = new AtomicInteger(99999);

		defs(map, g, 0, min);

		System.out.println(min.get());

	}

	public static void defs(HashMap<Integer, String[]> map, int g, int count, AtomicInteger min) {
		Set<Integer> set = map.keySet();
		for (Integer point : set) {
			int gc = g;
			int countc = count;
			String[] pointinfo = map.get(point);
			int monsuu = Integer.parseInt(pointinfo[0]);
			int bonus = Integer.parseInt(pointinfo[1]);
			if (monsuu * point + bonus < gc) {
				gc -= monsuu * point + bonus;
				countc += monsuu;
			} else {
				for (int i = 0; i < monsuu; i++) {
					gc -= point;
					countc++;
					if (min.get() <= countc) {
						continue;
					}
					if (gc <= 0) {
						if (countc < min.get()) {
							min.set(countc);
						}
						continue;
					}
				}
				gc -= bonus;
				if (gc <= 0) {
					if (countc < min.get()) {
						min.set(countc);
					}
					continue;
				}
			}
			HashMap<Integer, String[]> newmap = new HashMap<Integer, String[]>(map);
			newmap.remove(point);
			defs(newmap, gc, countc, min);
		}
	}

}
//  [java]

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	static Scanner scanner;
    static int min=Integer.MAX_VALUE;
    static long G;
    static long[] P;
    static long[] C;
	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    int D=gi();
	    G=gl();
	    P=new long[D];
	    C=new long[D];
	    for (int i=0; i<D;i++) {
	    	P[i]=gl();
	    	C[i]=gl();
	    }


        List<Integer> l= new ArrayList<Integer>();
        f(l, D);
        System.out.println(min);
//	    if(max>s-max) {
//	    	System.out.println(s-max-1);
//	    }
	}

	public static void f(List<Integer> l, int n) {
		if(l.size()==n) {
			long score=0;
			int c=0;
			for (int i=0; i<n;i++) {
				int index=l.get(i);
				if(index*100*P[index-1] +C[index-1] >=G-score) {
				    for (int j=0; j<P[index-1]; j++) {
					    score+=index*100;
					    c++;
					    if(j==P[index-1]-1) score+=C[index-1];
				    	if(score>=G) {
						    if (c<min)min=c;
					    	return;
				    	}
			    	}
				} else {
					score +=index*100*P[index-1] +C[index-1];
					c+=P[index-1];
				}
			}
			return;
		}
		for (int i=1; i<=n;i++) {
			if (!l.contains(i)) {
				List<Integer> nl=new ArrayList<Integer>();
				nl.addAll(l);
				nl.add(i);
				f(nl, n);
			}
		}
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}
//  [cpp]
#include <iostream>
using namespace std;
int main(){
  	cin.tie(0);
  	ios::sync_with_stdio(false);
    int D, G, p[11], c[11];
    cin >> D >> G;
    for(int i = 0; i < D; ++i){
        cin >> p[i] >> c[i];
    }

    int ans = 1e9;
    for(int mask = 0; mask < (1 << D); ++mask){
        int s = 0, num = 0, rest_max = -1;
        for(int i = 0; i < D; ++i){
            if(mask >> i & 1){
                s += 100 * (i+1) * p[i] + c[i];
                num += p[i];
            }else{
                rest_max = i;
            }
        }
        if(s < G){
            int s1 = 100 * (rest_max + 1);
            int need = (G - s + s1 - 1) / s1;
            if(need >= p[rest_max]){
                continue;
            }
            num += need;
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
}
//  [cpp]
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
 
#define _USE_MATH_DEFINES
#define mp       make_pair
#define pb       push_back
#define fst      first
#define snd      second
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
 
using namespace std;
 
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
 
const int INF=1<<29;
const double EPS=1e-9;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
 
int D, G;
int p[10], c[10], s[10];
bool used[10];
 
int all_search(int d, int g)
{
    if(g >= G)
        return 0;
 
    if(d == D) {
        int m;
        for(m = D-1; used[m] && m >= 0; m--)
            ;
        if(g + 100*(m+1)*(p[m]-1) < G)
            return INF;
 
        return (int)ceil((double)(G-g) / (100 * (m+1)));
    }
 
    int ans = all_search(d+1, g);
    used[d] = true;
    ans = min(all_search(d+1, g+s[d])+p[d], ans);
    used[d] = false;
 
    return ans;
}
 
int main()
{
    cin >> D >> G;
    rep(i, D) {
        cin >> p[i] >> c[i];
        s[i] = 100*(i+1)*p[i] + c[i];
        used[i] = false;
    }
 
    cout << all_search(0, 0) << endl;
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define MOD 1000000007
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using Complex = complex<double>;


int D, G;
int p[20], c[20];


signed main(){
    cin >> D >> G, G/=100;
    rep(i, 0, D) cin >> p[i] >> c[i], c[i]/=100;

    int ans = INF;
    rep(i, 0, 1<<D){
        int s = 0;
        int cnt = 0;
        repr(j, D, 0){
            if(!((i>>j)&1)) continue;
            if(CEIL((G-s)/(j+1)) < p[j]) chmin(ans, cnt+CEIL((G-s)/(j+1)));
            else if(CEIL((G-(s+c[j]))/(j+1)) <= p[j]) chmin(ans, cnt+p[j]);
            else s += (j+1)*p[j]+c[j], cnt += p[j];
        }
    }

    cout << ans << endl;

    return 0;
}
//  [cpp]
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
const int INF=int(1e9);
int n,goal;
int con[15][2];
map<int,int>dp[15];
int DP(int x,int y)
{
	if(y<=0) return 0;
	if(x<1) return INF;
	if(dp[x].count(y)) return dp[x][y];
	dp[x][y]=INF;
	for(int i=0;i<con[x][0];i++)
		dp[x][y]=min(dp[x][y],DP(x-1,y-i*x)+i);
	dp[x][y]=min(dp[x][y],DP(x-1,y-con[x][0]*x-con[x][1])+con[x][0]);
	return dp[x][y];
}
int main()
{
	scanf("%d%d",&n,&goal);
	goal/=100;
	for(int i=1;i<=n;i++)
		scanf("%d%d",&con[i][0],&con[i][1]),con[i][1]/=100;
	printf("%d\n",DP(n,goal));
	return 0;
}
//  [cpp]
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

pll pc[15];

vector<vector<int>> s;
int D;
bool c = false;
ll sum = 0;
ll sumI = 0;
ll n;

inline void dfs(vector<int> v)
{
	if (v.size() == D)
	{
		s.push_back(v);
		return;
	}
	IREP(i, D - 1)
	{
		c = false;
		REP(j, v.size())
		{

			if (v[j] == i)
			{
				c = true;
				break;
			}
		}
		if (c)continue;

		v.push_back(i);
		dfs(v);
		v.pop_back();
	}
	return;
}

int main()
{

	ll G;
	cin >> D >> G;
	vector<ll> v(D);//! 全部解いたら何点？
	ll t = 1;
	REP(i, D)
	{
		t *= (i + 1);
		cin >> pc[i].first >> pc[i].second;
		v[i] = (i + 1) * pc[i].first * 100 + pc[i].second;
	}

	vector<int> tmp;
	dfs(tmp);


	ll ans = INF;

	REP(i, s.size())
	{
		sum = 0;
		sumI = 0;
		REP(j, D)
		{
			int index = s[i][j];
			ll n = (G - sum + 100 * (1 + index) - 1) / (100 * (1 + index));
			if (n < pc[index].first)
			{
				sum += 100 * (1 + index)*n;
				sumI += n;
			}
			else
			{
				sum += v[index];
				sumI += pc[index].first;
			}
			if (sum >= G)
			{
				ans = std::min(ans, sumI);
				break;
			}
			if (ans <= sumI)
			{
				break;
			}
		}
	}

	cout << ans << endl;

	return 0;
}
//  [cpp]
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using std::cerr;using std::cin;using std::cout;using std::abs;using std::min;using std::max;using std::swap;using std::map;using std::unordered_map;using std::unordered_set;using std::bitset;using std::pair;using std::set;using std::string;using std::vector;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;using vci=vector<int>;using vcl=vector<ll>;template<typename T>void _dbg(const char*_s,T _h){cerr<<_s<<" = "<<_h<<"\n";}template<typename T,typename...Ts>void _dbg(const char*_s,T _h,Ts..._t){int _b=0;while(((_b+=*_s=='(')-=*_s==')')!=0||*_s!=',')cerr<<*_s++;cerr<<" = "<<_h<<",";_dbg(_s+1,_t...);}
#define f first
#define s second
#define pb emplace_back
struct init{init(){cin.tie(0);std::iostream::sync_with_stdio(0);cout<<std::fixed<<std::setprecision(10);cerr<<std::fixed<<std::setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;
ll p[11],c[11];
int32_t main() {
    
    ll n,g;
    cin>>n>>g;
    for(int i=1;i<=n;++i)
        cin>>p[i]>>c[i];
    vector<int> v(n);
    iota(v.begin(), v.end(), 1);
    int ans=123456789;
    do{
        ll cur=g;
        int pot=0;
        for (int i : v){
            int w=p[i];
            while(w&&cur>0){
                pot++;
                w--;
                cur-=i*100;
            }
            if(!w)
                cur -= c[i];
            if(cur<0){
                break;
            }
        }
        ans=min(ans,pot);
    }while(next_permutation(v.begin(), v.end()));
    cout<<ans<<'\n';

    

    return 0;
}
//  [c]
#include <stdio.h>
#include <math.h>

int main(void) {

  int d;
  long g;
  scanf("%d %ld", &d, &g);
  long p[d],c[d];
  for (int i = 0; i < d; i++) {
  scanf("%ld %ld", &p[i], &c[i]);
  }
  int bit[d];
  bit[0] = -1;
  for (int i = 1; i < d; i++) {
    bit[i] = 0;
  }
  long score;
  long solve;
  long min = -1;
  for (long i = 0; i < pow(2,d); i++) {
    bit[0]++;
    for (int j = 1; j < d; j++) {
      bit[j] += bit[j-1]/2;
      bit[j-1] %= 2;
    }
    score = 0;
    solve = 0;
    for (int j = 0; j < d; j++) {
      if (bit[j] == 1) {
        score += (j+1)*100*p[j]+c[j];
        solve += p[j];
      }
    }
    if (score >= g) {
      if (min == -1 || solve < min) {
        min = solve;
      }
      continue;
    }
    for (int j = d-1; j >= 0; j--) {
      if (bit[j] == 0) {
        if (score+(j+1)*100*(p[j]-1) < g) {
          score += (j+1)*100*(p[j]-1);
          solve += p[j]-1;
        } else {
          solve += (g-score+(j+1)*100-1)/((j+1)*100);
          score += (j+1)*100*((g-score+(j+1)*100-1)/((j+1)*100));
          break;
        }
      }
    }
    if (score >= g) {
      if (min == -1 || solve < min) {
        min = solve;
        continue;
      }
    }
  }
  printf("%ld\n", min);

  return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>

int power(int m, int n);

int main(void)
{
    int d,g,p[10],c[10],i,j,comp[1024][10],score,ans=1000,num,jmax;

    scanf("%d %d",&d,&g);
    for ( i = 0; i < d; i++)
    {
        scanf("%d %d",p+i,c+i);
    }

    for ( i = 0; i <= power(2,d)-1; i++)
    {
        for ( j = 0; j < d; j++)
        {
            comp[i][j]=(i%power(2,j+1))/power(2,j);
        }
    }

    for ( i = 0; i <= power(2,d)-1; i++)
    {
        score=0;
        num=0;
        for ( j = 0; j < d; j++)
        {
            if(comp[i][j]==1)
            {
                score+=p[j]*100*(j+1)+c[j];
                num+=p[j];
            }
        }
    
        if(score<g)
        {
            jmax=-1;
            for ( j = 0; j < d; j++)
            {
                if(comp[i][j]==0) jmax=j;
            }
            if(jmax!=-1)
            {
                if(((g-score)+(100*(jmax+1))-1)/(100*(jmax+1))<=p[jmax]-1)
                {
                    num+=((g-score)+(100*(jmax+1))-1)/(100*(jmax+1));
                    if(ans>num) ans=num;
                }
            }
        }
        else if(ans>num) ans=num;
    }

    printf("%d",ans);

    return 0;
}

int power(int m, int n)
{
    int p=1;
    for (int i = 0; i < n; i++)
    {
        p*=m;
    }

    return p;
}
//  [c]
#include <stdio.h>
int main(void){
    int d,g,i,j,k;
    long int res=1<<30;
    scanf("%d %d",&d,&g);
    int p[d];
    int c[d];
    for(i=0;i<d;i++)
        scanf("%d %d",&p[i],&c[i]);
    for(i=0;i<(1<<d);i++){
        // printf("%d回目-----------------------\n",i+1);
        long int sum=0;
        long int cnt=0;
        for(j=0;j<d;j++){
            // 全完したとき
            if(i&(1<<j)){
                sum+=c[j]+p[j]*100*(j+1);
                cnt+=p[j];
            }
        }
        // printf("sum=%ld,cnt=%ld\n",sum,cnt);
        if(sum>=g){
            if(cnt<res) res=cnt;}
        else{
            // printf("No zenkan\n");
            for(j=d-1;j>=0;j--){
                if(i&(1<<j)) continue;
                //問題数分繰り返す
                for(k=0;k<p[j];k++){
                    // printf("sum=%ld\n",sum)
                    if(sum>=g) break;
                    sum+=100*(j+1);
                    cnt++;
                }
            }
            if(cnt<res) res=cnt;
        }
    }
    printf("%ld\n",res);
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <limits.h>

int d,g,q,ans=INT_MAX;
long long score,p[12],c[12];
bool qa[12];

int cnt(int a){
    long long tmp=0;
    int count=0;
    do {
        tmp+=100*(a+1);
        count++;
        if (count==p[a]){
            tmp+=c[a];
        }
    } while(score+tmp<g && count<p[a]);
    
    if (score+tmp>=g){
        if (ans>q+count){
            ans=q+count;
        }
    } else {
        qa[a]=true;
        q+=count;
        score+=tmp;
        for (int i=0; i<d; i++){
            if (qa[i]==false){
                cnt(i);
                qa[i]=false;
            }
        }
        score-=tmp;
        q-=count;
    }
    return 0;
}

int main(void){
    scanf("%d%d",&d,&g);
    for (int i=0; i<d; i++){
        scanf("%lld%lld",&p[i],&c[i]);
        qa[i]=false;
    }
    for (int i=0; i<d; i++){
        cnt(i);
        qa[i]=false;
    }
    printf("%d\n",ans);
	return 0 ;
}
//  [c]
#include <stdio.h>

int	D, G;
int	p[11] = {0};
int	c[11] = {0};

void	culc_min(int state[11], int score, int *num, int temp)
{
	int	i, j;
	int	now_score;
	int	now_num;

	if (score >= G)
	{
		if (temp < *num)
		{
			*num = temp;
		}
		return ;
	}
	for (i = 0; i < D; i++)
	{
		if (state[i] == 1)
			continue ;
		state[i]++;
		now_score = score;
		now_num = temp;
		for (j = 0; j < p[i] - 1; j++)
		{
			now_score += (i + 1) * 100;
			now_num++;
			if (now_score >= G)
			{
				culc_min(state, now_score, num, now_num);
			}
		}
		now_score += (i + 1) * 100 + c[i];
		now_num++;
		culc_min(state, now_score, num, now_num);
		state[i]--;
	}
}

int		main(void)
{
	int	state[11] = {0};
	int	score = 0;
	int	num = 10000;
	int	i;

	//入力
	scanf("%d%d", &D, &G);
	for (i = 0; i < D; i++)
	{
		scanf("%d%d", &p[i], &c[i]);
	}
	//処理
	culc_min(state, score, &num, 0);
	printf("%d\n", num);
	return (0);
}
//  [c]
#include<stdio.h>

int main(){
		int d,g;
		scanf("%d%d",&d,&g);
		int p[d][2],i,j,test[10],temp=0,point=0,mini=0;
		for(i=0;i<d;i++){
				scanf("%d%d",&p[i][0],&p[i][1]);
				mini+=p[i][0];
		}
		for(test[0]=0;test[0]<2;test[0]++){
		for(test[1]=0;test[1]<2;test[1]++){
		for(test[2]=0;test[2]<2;test[2]++){
		for(test[3]=0;test[3]<2;test[3]++){
		for(test[4]=0;test[4]<2;test[4]++){
		for(test[5]=0;test[5]<2;test[5]++){
		for(test[6]=0;test[6]<2;test[6]++){
		for(test[7]=0;test[7]<2;test[7]++){
		for(test[8]=0;test[8]<2;test[8]++){
		for(test[9]=0;test[9]<2;test[9]++){
				temp=0;point=0;i=0;
				while(i<d){
						if(test[i]==1){
								temp+=p[i][0];
								point+=p[i][1];
								point+=(p[i][0]*(i+1)*100);
						}
						i++;
				}i=d-1;
				while(g>point){
					if(test[i]==0){
							for(j=0;j<p[i][0];j++){
									point+=(i+1)*100;
									temp++;
									if(g<=point)break;
							}
							if(j==p[i][0]-1)point+=p[i][1];
					}
					i--;
				}
				if(temp<mini)mini=temp;
		}
		}
		}
		}
		}
		}
		}
		}
		}
		}
		printf("%d\n",mini);
		return 0;
}
//  [javascript]
"use strict";
    
const div = (a, b) => Math.floor(a / b);

const main = arg => {
    arg = arg.trim().split("\n");
    const D = parseInt(arg[0].split(" ")[0]);
    const G = parseInt(arg[0].split(" ")[1]);
    
    const scores = arg.slice(1, D + 1);
    
    let p = [];
    let c = [];
    
    for(let i=0; i<D; i++) {
        let temp = scores[i].split(" ").map(n=>parseInt(n));
        p[i] = temp[0];
        c[i] = temp[1];
    }
    
    let ans = 1e9;
    
    for (let mask = 0; mask < (1 << D); ++mask) {
        let s = 0, num = 0, rest_max = -1;
        
        for (let i = 0; i < D; ++i) {
            if (mask >> i & 1) {
                s += 100 * (i + 1) * p[i] + c[i];
                num += p[i];
            } else rest_max = i;
        }
        
        if (s < G) {
            let s1 = 100 * (rest_max + 1);
            let need = div(G - s + s1 - 1, s1);
            if (need >= p[rest_max]) continue;
            num += need;
        }
        
        ans = Math.min(ans, num);
    }
    
    console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
'use strict'
function main(input) {
  input = input.trim().split('\n')
  const DG = input.shift().split(' ').map(v => Number(v))
  input = input.map(v => v.split(' ').map(v => Number(v)))
  let ans = -1
  for (let i = 0; i < Math.pow(2, DG[0]); i++) {
    let flag = ('0000000000' + i.toString(2)).slice(-1 * DG[0])
    let max = -1
    let score = DG[1]
    let count = 0
    for(let j = 0; j < DG[0]; j++) {
      if (flag[j] === '1') {
        let point = (j+1) * 100
        score -= point * input[j][0] + input[j][1]
        count += input[j][0]
      } else {
        max = j
      }
    }
    if (score > 0 && ~max) {
      let point = (max+1) * 100
      let num = Math.ceil(score / point)
      num = input[max][0] > num ? num : input[max][0]
      count += num
      score -= point * num
    }
    if (score <= 0 && (!~ans || ans > count)) {
      ans = count
    }
  }
  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(s){
  s = s.split("\n");
  var d = s[0].split(" ").map(a=>+a);
  var g = d[1] / 100;
  d = d[0];
  var p = [];
  for(var i = 0; i < d; i++){
    p[i] = s[i+1].split(" ").map(a=>+a);
    p[i][1] /= 100;
    p[i][1] = p[i][0] * (i+1) + p[i][1];
  }
  var ans = 9e9;
  for(i = 0; i < 1<<d; i++){
    var u = 0, v = 0, w = -1;
    for(var j = 0; j < d; j++){
      if(i & (1<<j)){u += p[j][0]; v += p[j][1]}
      else w = j;
    }
    var t = 0;
    if(w >= 0)while(v < g && t++ < p[w][0]){
      u++;
      v += w + 1;
    }
    if(v >= g && ans > u)ans = u;
  }
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));
//  [javascript]
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n');
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr('time : ' + end + 'ms');
  myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var one = nextIntArray();
  var D = one[0];
  var G = one[1] / 100;
  var plist = new Array(D);
  var blist = new Array(D);
  for(var i = 0; i < D; i++){
    var tmp = nextIntArray();
    plist[i] = tmp[0];
    blist[i] = tmp[1] / 100;
  }
  
  var min = 10000;
  var dp = new Array(G + 1).fill(min);
  //dp[i] = i点の時の最小正答数
  dp[0] = 0;
  for(var i = 0; i < D; i++){
    var count = plist[i];
    var bonus = blist[i];
    for(var j = G - 1; j >= 0; j--){
      for(var k = 1; k <= count; k++){
        var check = j + k * (i + 1);
        if(k == count){
          check += bonus;
        }
        var t = Math.min(G, check);
        dp[t] = Math.min(dp[t], dp[j] + k);
      }
    }
  }
  
  myout(dp[G]);
}
//  [javascript]
module.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=0)}([function(e,r,t){t(1)(t(2).readFileSync("/dev/stdin","UTF-8"))},function(e,r){e.exports=function(e){for(var r=e.split("\n"),t=r[0].split(" "),n=Number(t[0]),o=Number(t[1]),f=[],u=[],a=0;a<n;a++){var i=r[a+1].split(" "),l=Number(i[0]),p=Number(i[1]);f.push(l),u.push(p)}for(var s=9999999,c=[],d=0;d<n;d++)c.push(0);for(var v=[{depth:0,flags:c}];v.length>0;){var b=v.shift();if(b.depth<n){var g=b.flags.concat();g[b.depth]=1;var h={depth:b.depth+1,flags:g};v.push(h);var y=b.flags.concat(),m={depth:b.depth+1,flags:y};v.push(m)}if(b.depth==n){for(var x=0,j=0,O=0;O<n;O++)1==b.flags[O]&&(j+=100*(O+1)*f[O]*b.flags[O],j+=u[O],x+=f[O]);if(j<o)for(var S=n-1;S>=0;S--)if(1!=b.flags[S]){for(var _=0;_<f[S]&&(x+=1,!((j+=100*(S+1))>=o));_++);if(j>=o)break}x<s&&(s=x)}}console.log(s)}},function(e,r){e.exports=require("fs")}]);
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func min(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}

func divFloor(a, b int) int {
	return (a + (b - 1)) / b
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	d, g := nextInt(), nextInt()
	p, c := make([]int, d), make([]int, d)
	for i := 0; i < d; i++ {
		p[i], c[i] = nextInt(), nextInt()
	}

	// 合計点，解いた問題数を返す
	var rec func(solved []bool, id, point, sum int) (int, int)
	rec = func(solved []bool, id, point, sum int) (int, int) {
		if id == d {
			if point < g {
				for i := d - 1; i >= 0; i-- {
					if !solved[i] && 100*(i+1)*p[i] >= (g-point) {
						x := divFloor((g - point), 100*(i+1))
						point, sum = point+100*(i+1)*x, sum+x
						break
					}
				}
			}
			if point < g {
				return 0, 10000
			}
			return point, sum
		}
		// 解かない場合
		solved[id] = false
		r0, s0 := rec(solved, id+1, point, sum)
		// 解く場合
		solved[id] = true
		point += 100*(id+1)*p[id] + c[id]
		sum += p[id]
		r1, s1 := rec(solved, id+1, point, sum)
		if r0 >= g && r1 >= g {
			return g, min(s0, s1)
		} else if r0 >= g {
			return r0, s0
		} else if r1 >= g {
			return r1, s1
		}
		return 0, 10000
	}

	_, ans := rec(make([]bool, d), 0, 0, 0)

	puts(ans)
}