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<string>
#include<vector>
#include<algorithm>
typedef long long ll;
using namespace std;
#define INFLL (1LL << 60)
#define rep(i, n) for(int i=0; i<(n); ++i)

int main()
{
	int N; ll W; cin >> N >> W;
	ll vs[40], ws[40];
	rep(i, N) cin >> vs[i] >> ws[i];

	auto bitCalc = [&](int D, int offset)
	{
		vector<pair<ll, ll>> items;
		for (int bit = 0; bit < 1 << D; ++bit) {
			pair<ll, ll> sum(0, 0);
			for (int i = 0; i < D; ++i) {
				if (bit & (1 << i)) {
					sum.first += vs[i + offset];
					sum.second += ws[i + offset];
				}
			}
			if (sum.second <= W) items.push_back(sum);
		}
		return items;
	};
	auto A = bitCalc(N / 2, 0);
	auto B = bitCalc((N + 1) / 2, N / 2);

	auto cmpr = [](pair<ll, ll> a, pair<ll, ll> b) {
		if (a.first != b.first) return a.first > b.first;
		return a.second < b.second;
	};

	sort(B.begin(), B.end(), cmpr);
	auto p = B[0];
	for (int i = 0; i < B.size() - 1; ++i) {
		if (B[i + 1].first <= p.first && B[i + 1].second >= p.second) {
			B[i + 1].first = 0;
			B[i + 1].second = INFLL;
		}
		else {
			p = B[i + 1];
		}
	}
	sort(B.begin(), B.end(), cmpr);

	ll ans = 0;
	for (auto a : A) {
		for (auto b : B) {
			if (a.second + b.second <= W) {
				ans = max(ans, a.first + b.first);
				break;
			}
		}
	}
	cout << ans << endl;;
	return 0;
}

