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>
#include <cmath>

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 10;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);


void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;
const int mod = 1000000007;

struct Item {
    ll value;
    ll weight;
};

map<ll, ll> conv(vector<Item> &items, ll w) {
    map<ll, ll> ans;
    ans[0] = 0;
    int n = items.size();
    for (int i = 0; i < (1 << n); i++) {
        if (i == 0) continue;
        ll value = 0, weight = 0;
        for (int j = 0; j < n; j++) {
            if ((i >> j) & 1) {
                value += items[j].value;
                weight += items[j].weight;
            }
        }
        if (weight > w) continue;

        auto it = ans.upper_bound(weight);
        it--;
        assert((*it).first <= weight);
        if ((*it).second >= value) {
            continue;
        }
        assert(ans[weight] < value);
        assert((*it).second < value);
        ans[weight] = value;

        set<ll> del_key;
        auto del_it = ans.find(weight);
        del_it++;
        for (; (*del_it).second <= value && del_it != ans.end(); del_it++) {
            del_key.insert((*del_it).first);
        }

        for (ll d : del_key) ans.erase(d);

    };
    return ans;
}


int main() {

    int n;
    ll w;
    cin >> n >> w;

    vector<Item> items(n);
    rep(i, n) {
        cin >> items[i].value >> items[i].weight;
    }

    vector<Item> items1, items2;
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) items1.push_back(items[i]);
        else items2.push_back(items[i]);
    }

    map<ll, ll> ans1 = conv(items1, w), ans2 = conv(items2, w);

    ll ans = 0;
    for (auto e1 : ans1) {
        ll nokori = w - e1.first;
        auto e2_it = ans2.upper_bound(nokori);
        e2_it--;
        auto e2 = *e2_it;
        ll value = e1.second + e2.second;
        cmax(ans, value);
    }

    cout << ans << endl;

}


