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
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;
long long int INF = 1e18;

int main()
{
	long long int N, W;
	cin >> N >> W;
	
	vector<P> v1, v2;
	P p;
	p.first = 0;
	p.second = 0;
	v1.push_back(p);
	v2.push_back(p);
	
	for(int i = 0; i < N / 2; i++){
		long long int v, w;
		cin >> v >> w;
		int sz = v1.size();
		for(int j = 0; j < sz; j++){
			p = v1[j];
			p.first += w;
			p.second += v;
			v1.push_back(p);
		}
	}
	
	for(int i = 0; i < (N + 1) / 2; i++){
		long long int v, w;
		cin >> v >> w;
		int sz = v2.size();
		for(int j = 0; j < sz; j++){
			p = v2[j];
			p.first += w;
			p.second += v;
			v2.push_back(p);
		}
	}
	
	p.first = INF;
	p.second = 0;
	
	v2.push_back(p);
	
	long long int ans = 0;
	int id = 0;
	
	sort(v1.begin(), v1.end());
	sort(v2.begin(), v2.end());
	/*
	for(int i = 0; i < v1.size(); i++){
		cout << v1[i].first << " " << v1[i].second << endl;
	}
	cout << endl;
	for(int i = 0; i < v2.size(); i++){
		cout << v2[i].first << " " << v2[i].second << endl;
	}
	*/
	long long int vmax = 0;
	for(int i = v1.size() - 1; i >= 0; i--){
		if(v1[i].first > W){
			continue;
		}
		while(true){
			vmax = max(vmax, v2[id].second);
			if(v1[i].first + v2[id + 1].first > W){
				break;
			}
			id++;
		}
		ans = max(ans, v1[i].second + vmax);
	}
	
	cout << ans << endl;
	
	return 0;
}
