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 ≤ 40
* 1 ≤ vi ≤ 1015
* 1 ≤ wi ≤ 1015
* 1 ≤ W ≤ 1015

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
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;
using namespace std;

ll inf=1000000000000000*40;
pair<ll,ll> pl[1<<20];
ll v[40],w[40];
int main(){
    int n;
    ll ww;
    cin>>n>>ww;
    rep(i,n) cin>>v[i]>>w[i];
    //half split
    int n2=n/2;
    rep(i,1<<n2){
        ll sw=0,sv=0;
        rep(j,n2){
            if(i>>j&1){
                sw+=w[j];sv+=v[j];
            }
        }
        pl[i]=mp(sw,sv);
    }
    sort(pl,pl+(1<<n2));
    int m=1;
    rep(i,1<<n2){
        if(pl[m-1].second<pl[i].second) pl[m++]=pl[i];
    }
    ll ans=0;
    rep(i,1<<(n-n2)){
        ll sw=0,sv=0;
        rep(j,n-n2){
            if(i>>j&1){
                sw+=w[n2+j];sv+=v[n2+j];
            }
        }
        if(sw<=ww){
            ll tv=(lower_bound(pl,pl+m,mp(ww-sw,inf))-1)->second;
            ans=max(ans,sv+tv);
        }
    }
    cout<<ans<<endl;
    return 0;
}