#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;


int main() {
    int d,g; cin >> d >> g;
    vector<int> p(d), c(d);
    rep(i,d) cin >> p[i] >> c[i];
    int ans = 1001;
    int cnt = 0;
    int score = 0;
    rep(x,1<<d) { //全解きなら1，無解きなら0
        score = 0;
        cnt = 0;
        rep(i,d) {
            if (x & 1<<i) {
                score += 100*(i+1)*p[i]+c[i];
                cnt += p[i];
            }
        }
        //if (score > g) continue;
        int mx;
        rep(i,d) {
            if (!(x & 1<<(d-1-i))) {
                mx = d-1-i;
                break;
            }
        }
        int num = 0;
        while (score < g && num < p[mx]) {
            score += 100*(mx+1);
            num++;
            cnt++;
        }
        if (score >= g) {
            chmin(ans,cnt);
        }
    }
    cout << ans << endl;
}
#include<bits/stdc++.h>
using namespace std;
int head[600100],cnt,n,m,lim,dis[600100];
struct Node{
	int to,next,val;
}edge[4001000];
void ae(int u,int v,int w){
	edge[cnt].next=head[u],edge[cnt].to=v,edge[cnt].val=w,head[u]=cnt++;
}
map<pair<int,int>,int>mp;
priority_queue<pair<int,int> >q;
bool vis[600100];
int dijkstra(){
	dis[1]=0,q.push(make_pair(0,1));
	while(!q.empty()){
		int x=q.top().second;q.pop();
		if(vis[x])continue;vis[x]=true;
		for(int i=head[x];i!=-1;i=edge[i].next)if(dis[edge[i].to]>dis[x]+edge[i].val)dis[edge[i].to]=dis[x]+edge[i].val,q.push(make_pair(-dis[edge[i].to],edge[i].to));
	}
	return dis[n]==0x3f3f3f3f?-1:dis[n];
}
int hs(int x,int c){
	if(mp.find(make_pair(x,c))!=mp.end())return mp[make_pair(x,c)];
	lim++;
//	printf("(%d,%d)->%d\n",x,c,lim);
	ae(x,lim,1);
	ae(lim,x,0);
	return mp[make_pair(x,c)]=lim;
}
int main(){
	scanf("%d%d",&n,&m),memset(head,-1,sizeof(head)),memset(dis,0x3f3f3f3f,sizeof(dis)),lim=n;
	for(int i=1,u,v,w;i<=m;i++){
		scanf("%d%d%d",&u,&v,&w);
		ae(hs(u,w),hs(v,w),0),ae(hs(v,w),hs(u,w),0);
	}
	printf("%d\n",dijkstra());
	return 0;
}