Problem: You have N items that you want to put them into a knapsack. Item i has value vi and weight wi.

You want to find a subset of items to put such that:

* The total value of the items is as large as possible.
* The items have combined weight at most W, that is capacity of the knapsack.



Find the maximum total value of items in the knapsack.

Constraints

* 1 ≤ N ≤ 100
* 1 ≤ vi ≤ 100
* 1 ≤ wi ≤ 10,000,000
* 1 ≤ W ≤ 1,000,000,000

Input


N W
v1 w1
v2 w2
:
vN wN


The first line consists of the integers N and W. In the following N lines, the value and weight of the i-th item are given.

Output

Print the maximum total values of the items in a line.

Examples

Input

4 5
4 2
5 2
2 1
8 3


Output

13


Input

2 20
5 9
4 10


Output

9

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = ((B)-1); I >= (A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define pri(a) cout << (a) << endl

template <typename T>
struct Knap_Big_Weight{
	T W;
	int N,max_v;
	vector<int> v;
	vector<T> w;
	vector< vector<T> > dp;
	Knap_Big_Weight(int N_, T W_ ,int max_v_){
		W = W_;
		N = N_;
		max_v = max_v_;
		v.resize(N);
		w.resize(N);
		dp = vector< vector<T> >(2,vector<T>(max_v*N+1,W+1));
	}
	int calc(){
		dp[0][0] = dp[1][0] = 0;
		for(int i=1;i<=N;i++){
			for(int j=0;j<=N*max_v;j++){
				int k = i%2;
				int l = 1-k;
				if(j<v[i-1]){
					dp[k][j] = dp[l][j];
				}else{
					dp[k][j] = min(dp[l][j],dp[l][j-v[i-1]]+w[i-1]);
				}
			}
		}
		int k = N%2;
		for(int i=N*max_v;i>=0;i--){
			if(dp[k][i] < W+1){
				return i;
			}
		}
	}
};







int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll N,W;
	cin >> N >> W;
	Knap_Big_Weight<ll> kbw(N,W,100);
	FOR(i,0,N){
		cin >> kbw.v[i] >> kbw.w[i];
	}
	cout << kbw.calc() << endl;
}