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 <stdio.h>
#include <vector>
#include <utility>
#include <algorithm>
typedef long long ll;
using namespace std;

int main(void) {
  ll i, j, k, n, w, ans = 0;
  scanf("%lld%lld", &n, &w);
  pair<ll, ll> vw[n];
  for(i = 0; i < n; ++i) scanf("%lld%lld", &vw[i].second, &vw[i].first);
  vector< pair<ll ,ll> > v1, v2;
  vector<ll> v2sum;
  for(i = 0; i < 1 << n / 2; ++i) {
    ll nw = 0, nv = 0;
    for(j = 0; j < n / 2; ++j) {
      if(i & 1 << j) nw += vw[j].first, nv += vw[j].second;
    }
    pair<ll, ll> p = make_pair(nw, nv);
    v1.push_back(p);
  }
  for(i = 0; i < 1 << (n + 1) / 2; ++i) {
    ll nw = 0, nv = 0;
    for(j = 0; j < (n + 1) / 2; ++j) {
      if(i & 1 << j) nw += vw[j + n / 2].first, nv += vw[j + n / 2].second;
    }
    pair<ll, ll> p = make_pair(nw, nv);
    v2.push_back(p);
  }
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());
  vector< pair<ll ,ll> >::iterator it1, it2;
  vector<ll>::iterator its;
  ll now = 0;
  for(it2 = v2.begin(); it2 != v2.end(); ++it2) {
    if(now < (*it2).second) now = (*it2).second;
    v2sum.push_back(now);
  }
  it2 = v2.end();
  its = v2sum.end();
  it2--, its--;
  /*for(it1 = v1.begin(); it1 != v1.end(); ++it1) printf("%lld %lld\n", (*it1).first, (*it1).second);
  for(it1 = v2.begin(); it1 != v2.end(); ++it1) printf("%lld %lld\n", (*it1).first, (*it1).second);*/
  for(it1 = v1.begin(); it1 != v1.end(); ++it1) {
    int s = 0;
    while((*it1).first + (*it2).first > w) {
      it2--;
      its--;
      if(it2 < v2.begin()) {
        s = 1;
        break;
      }
    }
    if(s) break;
    if(ans < (*it1).second + *its) ans = (*it1).second + *its;
  }
  printf("%lld\n", ans);
  return 0;
}
