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 lint;
typedef long double ldouble;
#define REP(i, x, n) for(int i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = 1e18;
const lint MOD = 1e9 + 7;
const lint inv = MOD - 2;

typedef pair<lint, lint> P;

int main(){
    int N;
    lint W;
    cin >> N >> W;
    vector<lint> v1(N/2), v2(N-N/2), w1(N/2), w2(N-N/2);
    rep(i, N/2){
        cin >> v1[i] >> w1[i];
    }
    rep(i, N-N/2){
        cin >> v2[i] >> w2[i];
    }
    vector<P> s1, s2;
    for(int i = 0 ; i < (1 << N/2) ; i++){
        lint v = 0, w = 0;
        for(int j = 0 ; j < N/2 ; j++){
            if(i >> j & 1){
                v += v1[j];
                w += w1[j];
            }
        }
        s1.push_back(make_pair(w, v));
    }
    for(int i = 0 ; i < (1 << N-N/2) ; i++){
        lint v = 0, w = 0;
        for(int j = 0 ; j < N-N/2 ; j++){
            if(i >> j & 1){
                v += v2[j];
                w += w2[j];
            }
        }
        s2.push_back(make_pair(w, v));
    }
    s2.push_back(make_pair(LLINF, 0));
    SORT(s2);
    rep(i, s2.size()-1){
        s2[i+1].second = max(s2[i+1].second, s2[i].second);
    }
    repr(i, s2.size()-1){
        if(s2[i].first == s2[i+1].first){
            s2[i].second = max(s2[i].second, s2[i+1].second);
        }
    }
    lint ans = 0;
    rep(i, s1.size()){
        lint tmpw = W - s1[i].first, tmpv = s1[i].second;
        int left = 0, right = s2.size() - 1, mid;
        while(left < right){
            mid = (left + right) / 2;
            if(s2[mid].first <= tmpw && tmpw < s2[mid+1].first){
                ans = max(ans, tmpv + s2[mid].second);
                break;
            }else if(tmpw < s2[mid].first){
                right = mid;
            }else{
                left = mid + 1;
            }
        }
    }
    cout << ans << endl;
    return 0;
}
