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<vector>
#include<algorithm>
using namespace std;
vector<pair<long long, long long>>s1, s2; long long n, W, Mid, v[40], w[40], maxn = 0;
int main() {
	cin >> n >> W; Mid = n / 2; for (int i = 0; i < n; i++)cin >> v[i] >> w[i];
	for (int i = 0; i < (1 << Mid); i++) {
		long long R1 = 0, R2 = 0; for (int j = 0; j < Mid; j++) { if ((i / (1 << j)) % 2 == 0) { R1 += v[j]; R2 += w[j]; } }
		s1.push_back(make_pair(R2, R1));
	}
	for (int i = 0; i < (1 << (n - Mid)); i++) {
		long long R1 = 0, R2 = 0; for (int j = 0; j < n - Mid; j++) { if ((i / (1 << j)) % 2 == 0) { R1 += v[j + Mid]; R2 += w[j + Mid]; } }
		s2.push_back(make_pair(R2, R1));
	}
	sort(s2.begin(), s2.end()); for (int i = 1; i < s2.size(); i++) { s2[i].second = max(s2[i].second, s2[i - 1].second); }
	for (int i = 0; i < s1.size(); i++) {
		int pos1 = lower_bound(s2.begin(), s2.end(), make_pair(W - s1[i].first + 1, 0LL)) - s2.begin();
		if (pos1 >= 1)maxn = max(maxn, s1[i].second + s2[pos1 - 1].second);
	}
	cout << maxn << endl;
	return 0;
}