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 MAX_N 40

int N;
long long W;
long long v[MAX_N];
long long w[MAX_N];

typedef pair< long long, long long > P;
vector< P > v1;
vector< P > v2;

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

	P p;
	p.first = 0;
	p.second = 0;
	v1.push_back( p );
	v2.push_back( p );

	int n2 = N / 2;
	int i;
	for( i = 0; i < n2; i++ ) {
		int sz = v1.size();
		for( int j = 0; j < sz; j++ ) {
			p = v1[j];
			p.first += w[i];
			p.second += v[i];
			v1.push_back( p );
		}
	}
	for( ; i < N; i++ ) {
		int sz = v2.size();
		for( int j = 0; j < sz; j++ ) {
			p = v2[j];
			p.first += w[i];
			p.second += v[i];
			v2.push_back( p );
		}
	}
	sort( v1.begin(), v1.end() );
	sort( v2.begin(), v2.end() );

	long long ans = 0;
	long long v2max = 0;
	int v2i = 0;
	int sz = v2.size();
	for( int v1i = v1.size() - 1; v1i >= 0; v1i-- ) {
		if( v1[v1i].first > W ) {
			continue;
		}
		while( v1[v1i].first + v2[v2i].first <= W && v2i < sz ) {
			v2max = max( v2max, v2[v2i].second );
			v2i++;
		}
		ans = max( ans, v1[v1i].second + v2max );
	}

	cout << ans << endl;

	return 0;
}

