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
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; ll W; cin >> N >> W;
    vector<ll> v(N),w(N);
    rep(i,N) cin >> v[i] >> w[i];
    
    int M = N/2;
    vector<pair<ll,ll>> left,right;
    for (int tmp = 0; tmp < (1 << M); tmp++) {
        bitset<20> s(tmp);
        ll val = 0;
        ll wei = 0;
        rep(i,M) {
            if (s.test(i)) {
                val += v[i];
                wei += w[i];
            } 
        }
        left.emplace_back(wei,val);
    }
    for (int tmp = 0; tmp < (1 << (N - M)); tmp++) {
        bitset<20> s(tmp);
        ll val = 0;
        ll wei = 0;
        rep(i,(N - M)) {
            if (s.test(i)) {
                val += v[M+i];
                wei += w[M+i];
            } 
        }
        right.emplace_back(wei,val);
    }

    sort(all(left)); sort(all(right));
    for (int i = 1; i < (1 << M); i++) {
        if (left[i].second <= left[i-1].second) {
            left[i] = left[i-1];
        }
    }
    for (int i = 1; i < (1 << (N-M)); i++) {
        if (right[i].second <= right[i-1].second) {
            right[i] = right[i-1];
        }
    }

    ll ans = 0;
    rep(i,(1 << M)) {
        int k = upper_bound(all(right),make_pair(W - left[i].first,ll(1e18))) - right.begin();
        if (k == 0) continue;
        k--;
        chmax(ans,right[k].second+left[i].second);
    }

    cout << ans << endl;
}
