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;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int N; ll W;
    cin >> N >> W;
    ll v[N], w[N];
    rep(i, N) cin >> v[i] >> w[i];
    map<ll, ll> mp;
    int n = N/2, m = N-n;
    rep(i, 1<<m){
        ll sv = 0, sw = 0;
        rep(j, m){
            if(i&(1<<j)) sv += v[n+j], sw += w[n+j];
        }
        chmax(mp[sw], sv);
    }
    ll now = 0;
    for(auto &e: mp){
        chmax(now, e.second);
        e.second = now;
    }
    ll ans = 0;
    rep(i, 1<<n){
        ll sv = 0, sw = 0;
        rep(j, n){
            if(i&(1<<j)) sv += v[j], sw += w[j];
        }
        map<ll, ll>::iterator it = mp.upper_bound(W-sw);
        if(it == mp.begin()) continue;
        chmax(ans, sv+(--it)->second);
    }
    cout << ans << endl;
}
