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 <cstdio>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;

#define int long long

typedef pair<int, int> pii;

int N, W;

int v[45], w[45];
int dp[1 << 21];

signed main()
{
    cin >> N >> W;

    for (int i = 0; i < N; ++i) {
        cin >> v[i] >> w[i];
    }

    vector<pii> arr1, arr2;

    int len1 = N / 2, len2 = N - len1;

    for (int bit = 0; bit < (1 << len1); ++bit) {
        pii hoge(0, 0);

        for (int j = 0; j < len1; ++j) {
            if (bit >> j & 1) {
                hoge.first += w[j], hoge.second -= v[j];
            }
        }

        arr1.push_back(hoge);
    }

    for (int bit = 0; bit < (1 << len2); ++bit) {
        pii hoge(0, 0);

        for (int j = 0; j < len2; ++j) {
            if (bit >> j & 1) {
                hoge.first += w[j + len1], hoge.second -= v[j + len1];
            }
        }

        arr2.push_back(hoge);
    }

    sort(begin(arr1), end(arr1));
    sort(begin(arr2), end(arr2));

    dp[0] = -arr2[0].second;
    for (int i = 1; i < arr2.size(); ++i) dp[i] = max(dp[i - 1], -arr2[i].second);

    int ma = 0;

    int now = -1, idx = (int)arr2.size() - 1;;
    for (int i = 0; i < arr1.size(); ++i) {
        while (idx && arr1[i].first + arr2[idx].first > W) idx--;

        if (arr1[i].first + arr2[idx].first > W) continue;

        ma = max(ma, -arr1[i].second + dp[idx]);
    }

    cout << ma << endl;
}