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;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
struct Item {
	int v, w;
	Item() :v(0), w(0) {}
	Item(int v, int w) :v(v), w(w) {}
	bool operator<(const Item &p)const {
		return w == p.w ? v < p.v : w < p.w;
	}
	Item operator+=(const Item &p) {
		v += p.v;
		w += p.w;
		return *this;
	}
	Item operator+(const Item &p) {
		Item x(*this);
		x += p;
		return x;
	}
};
istream &operator >> (istream &is, Item &p) {
	is >> p.v >> p.w;
	return is;
}
ostream &operator<<(ostream &os, Item p) {
	os << p.v << " " << p.w;
	return os;
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, W; cin >> N >> W;
	vector<Item> item(N); rep(i, 0, N) { cin >> item[i]; }
	int n1 = N / 2, n2 = N - n1;
	vector<Item>a, b;
	rep(bits, 0, 1 << n1) {
		Item x;
		rep(j, 0, n1)if (bits&(1 << j))x += item[j];
		a.push_back(x);
	}
	rep(bits, 0, 1 << n2) {
		Item x;
		rep(j, 0, n2)if (bits&(1 << j))x += item[n1 + j];
		b.push_back(x);
	}
	sort(all(b));
	int m(1);
	rep(i, 1, b.size()) {
		if (b[m - 1].v < b[i].v)b[m++] = b[i];
	}
	int ans(0);
	rep(i, 0, a.size()) {
		if (a[i].w > W)continue;
		chmax(ans, a[i].v + prev(upper_bound(b.begin(), b.begin() + m, Item(INF, W - a[i].w)))->v);
	}
	cout << ans << endl;
	return 0;
}