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 <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
    ll n,W; cin >> n >> W;
    vl v(n),w(n);
    rep(i,n) cin >> v[i] >> w[i];
    vpl fr,ba;
    rep(bit,1<<(n/2)){
        ll vs = 0, ws = 0;
        rep(i,n/2) if(bit>>i & 1) vs += v[i], ws += w[i];
        fr.emplace_back(P(ws,vs));
    }
    rep(bit,1<<(n-n/2)){
        ll vs = 0, ws = 0;
        rep(i,n-n/2) if(bit>>i & 1) vs += v[i+n/2], ws += w[i+n/2];
        ba.emplace_back(P(ws,vs));
    }
    sort(all(fr)); sort(all(ba));
    vpl ba2;
    ll mxv = -1;
    rep(bit,1<<(n-n/2)){
        if(mxv < ba[bit].second){
            ba2.emplace_back(ba[bit]);
            mxv = ba[bit].second;
        }
    }
    sort(all(ba2));
    ll ans = 0;
    for(auto i : fr){
        if(i.first > W) break;
        auto itr = upper_bound(all(ba2),P(W-i.first,linf));
        itr--;
        chmax(ans, (*itr).second + i.second);
    }
    cout << ans << endl;
}
