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 <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n;
  ll W;
  cin >> n >> W;
  ll v[n], w[n];
  REP(i, n) cin >> v[i] >> w[i];
  vector<P> vc1;
  int n2 = n / 2;
  REP(i, 1 << n2) {
    ll sw = 0, sv = 0;
    REP(j, n2) {
      if (i >> j & 1) {
        sw += w[j];
        sv += v[j];
      }
    }
    if (sw <= W) {
      vc1.push_back(P(sw, sv));
    }
  }
  sort(ALL(vc1));
  vector<P> vc2;
  REP(i, 1 << (n - n2)) {
    ll sw = 0, sv = 0;
    REP(j, n - n2) {
      if (i >> j & 1) {
        sw += w[n2 + j];
        sv += v[n2 + j];
      }
    }
    if (sw <= W) {
      vc2.push_back(P(sw, sv));
    }
  }
  sort(ALL(vc2));
  ll ans = 0, mx = 0;
  int j = 0;
  RREP(i, vc1.size()) {
    while (j < vc2.size() && vc1[i].first + vc2[j].first <= W) {
      mx = max(mx, vc2[j].second);
      j++;
    }
    ans = max(ans, vc1[i].second + mx);
  }
  cout << ans << endl;
  return 0;
}
