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>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n,w;
    cin>>n>>w;
    ll a[n],b[n];
    for(int i=0;i<n;i++){
    	cin>>a[i]>>b[i];
    }
    vector<pair<ll,ll> > v1,v2;
    ll m=n/2,maki=(1<<m);
    for(int bit=0;bit<maki;bit++){
    	ll vsum=0,wsum=0;
    	for(int i=0;i<m;i++)if(bit>>i&1){
    		vsum+=a[i];
    		wsum+=b[i];
    	}
    	if(wsum<=w)v1.push_back({wsum,-vsum});
    }
    sort(be(v1));
    ll niko=v1.size();
    ll s=1;
    for(int i=1;i<niko;i++)if(v1[s-1].first<v1[i].first&&v1[s-1].second>v1[i].second)v1[s]=v1[i],s++;
    for(int i=0;i<s;i++){
    	v1[i].second=-v1[i].second;
    }
    niko=m;
    m=n-m;maki=(1<<m);
    for(int bit=0;bit<maki;bit++){
    	ll vsum=0,wsum=0;
    	for(int i=0;i<m;i++)if(bit>>i&1){
    		vsum+=a[i+niko];
    		wsum+=b[i+niko];
    	}
    	if(wsum<=w)v2.push_back({wsum,-vsum});
    }
    sort(be(v2));
    m=1;maki=v2.size();
    for(int i=1;i<maki;i++)if(v2[m-1].first<v2[i].first&&v2[m-1].second>v2[i].second)v2[m]=v2[i],m++;
    for(int i=0;i<m;i++){
    	v2[i].second=-v2[i].second;
    }
    ll ans=0;
    vector<ll> c;
    for(int i=0;i<m;i++){
    	c.pb(v2[i].first);
    }
    for(int i=0;i<s;i++){
    	ans=max(ans,v1[i].second+v2[(upper_bound(be(c),w-v1[i].first)-c.begin()-1)].second);
    }
    cout<<ans<<endl;
    return 0;
}

