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;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=50001;
const ll INF=1LL<<60;

int main(){

    int N;
    ll W;cin>>N>>W;
    
    ll ans=0;
    
    vector<ll> v(N),w(N);
    for(int i=0;i<N;i++){
        cin>>v[i]>>w[i];
    }
    
    vector<pair<ll,ll>> A;
    
    for(int bit=0;bit<(1<<(N/2));bit++){
        ll vsum=0,wsum=0;
        for(int i=0;i<N/2;i++){
            if(bit&(1<<i)){
                vsum+=v[i];
                wsum+=w[i];
            }
        }
        A.push_back(make_pair(wsum,vsum));
        if(wsum<=W) ans=max(ans,vsum);
    }

    sort(all(A));
    
    ll maxi=0;
    
    for(int i=0;i<A.size();i++){
        A[i].second=max(maxi,A[i].second);
        maxi=A[i].second;
    }
    
    for(int bit=0;bit<(1<<(N-N/2));bit++){
        ll vsum=0,wsum=0;
        
        for(int i=0;i<N-N/2;i++){
            if(bit&(1<<i)){
                vsum+=v[N/2+i];
                wsum+=w[N/2+i];
            }
        }
        
        if(wsum>W) continue;
        
        wsum=W-wsum;
        
        auto it=lower_bound(all(A),make_pair(wsum+1,-INF));
        it--;
        
        ans=max(ans,(*it).second+vsum);
    }
    
    cout<<ans<<endl;
}


