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>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}


int N; ll W;
vector<ll> v,w;
vector<pair<ll,ll>> ps;

int main() {
  cin >>N >>W;
  v.assign(N, 0); w.assign(N, 0); rep(i, N) cin >>v[i] >>w[i];
  int n2 = N/2;
  ps.assign(1 << n2, {0,0});
  rep(i, 1 << n2){
    ll sv = 0, sw = 0;
    rep(j, n2){
      if ((i >> j) & 1){
        sv += v[j]; sw += w[j];
      }
    }
    ps[i] = {sw, sv};
  }
  sort(all(ps));
  // いらんやつらは端へ寄せて不要
  int m = 1; // いるやつらの配列の長さ
  for (int i=1; i<1 << n2; i++){
    if (ps[m-1].second < ps[i].second){
      ps[m++] = ps[i];
    }
  }

  ll res = 0;
  rep(i, 1 << (N-n2)){
    ll sv = 0, sw = 0;
    rep(j, N-n2){
      if ((i >> j) & 1){
        sv += v[n2+j]; sw += w[n2+j];
      }
    }
    if (sw > W) continue;
    ll tv = (lower_bound(ps.begin(), ps.begin() + m, make_pair(W-sw, INF)) - 1) -> second;
    chmax(res, sv + tv);
  }
  cout <<res <<endl;
}

