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>
#include <algorithm>
#include <cmath>
#include <set>
#include <cstdio>
#include <vector>
#include <iostream>
#include <utility>
#include <queue>
#include <map>

#define fir first
#define sec second
#define sz(s) (s).size()
#define pb push_back
#define get(n) scanf("%d",&n);
#define gets(s) string s;cin >> (s);
#define prfi(n) printf("%d", &n);
#define prfd(n) printf("%lf", &n);
#define All(s) (s).begin(), (s).end()
#define rep(i,j) for(int (i)=0;(i)<(j);(i)++)
#define For(i,j,k) for(int (i)=(j);(i)<(k);(i)++)
#define repd(i,j) for(int (i)=(j);(i)>=0;(i)--)
#define Ford(i,j,k) for(int (i)=(j);i>=(k);i--)
#define vfor(c,v) for(auto (c): v)
#define dump(x)  std::cout << #x << " = " << (x) << std::endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using ll = long long;
using pii = std::pair<int,int>;
using pll = std::pair<ll, ll>;
using vi = std::vector<int> ;
using vvi = std::vector<vi> ;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vd = std::vector<double> ;
using vvd = std::vector<vd> ;
using qi = std::queue<int> ;
using vpii = std::vector<std::pair<int, int> >;
using vpll = std::vector<pll>;
using namespace std;

const int Mod = (1e9) + 7;
const int max_n = 3 * (1e5) + 1;
const int max_m = 83 * (1e5) + 1;
const int INF = 1e9 + 19;
const ll INFL = 1e18 + 19;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
//_____________________________________Templates_________________________________________//

template<class T1, class T2> inline void chmin(T1 &a, T2 b){if(a > b) a = b;}
template<class T1, class T2> inline void chmax(T1 &a, T2 b){if(a < b) a = b;}

//mainly use for dynamic prog
template<class T1, class T2>
void update(T1 &a, T2 b){
  a += b;
  if(a > Mod) a %= Mod;
}

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
  cout << "\n";
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}
bool pairsort(pll pl, pll pr){
  if(pl.first == pr.first)return pl.second > pr.second;
  return pl.first < pr.first;
}
//_____________________　following sorce code_________________________//
int n,m,k;
//vvll dp(400, vll(400));
string S;
int a,b,c;
ll w;
vpll vp;
vpll up;
vll v;
vll cost;
vll u;
bool check(){
}

int LowerBound(ll x){
  int n2 = n/2;
  int l = 0, r = (1 << n2);
  while(l+1<r){
    int c = (l+r)/2;
    if(vp[c].first <= x)l = c;
    else r = c;
  }
  return l;
}

int main () {
  cin.tie(0);
  ios::sync_with_stdio(false);
  IN(n,w);
  //OUT(n,w);
  v = cost = vll(n);
  rep(i,n){
    IN(v[i], cost[i]);
  }
  //for(auto c : cost)OUT(c);
  int _n = n /2;
  vp = vpll(1 << _n);
  rep(i,1 << _n){
    ll sw = 0, sv = 0;
    rep(j,_n){
      if(i &(1<<j)){
        //dump(j);
        //dump(cost[j]);
        //dump(v[j]);
        sw += cost[j];
        sv += v[j];
      }
    }
    //dump(i);
    //dump(sw);
    //dump(sv);
    vp[i] = make_pair(sw, sv);
  }

  sort(All(vp),pairsort);
  pll p = vp[0];
  For(i,1,1 << _n){
    if(p.second > vp[i].second){
      vp[i] = p;
    }
    else {
      p = vp[i];
    }
  }
  /*for(auto c : vp){
  	OUT(c.fir, c.sec);
  }*/
  ll res = 0;
  rep(i,1 << (n - _n)){
    ll sw = 0, sv = 0;
    rep(j,n - _n){
      if(i & (1 << j)){
        sw += cost[_n+j];
        sv += v[_n+j];
      }
    }
    //dump(sw);
    //dump(sv);
    if(sw <= w){
      //dump(sw);
      ll pos = LowerBound(w - sw);
      //dump(pos);
      //OUT(sw+vp[pos].second);
      chmax(res, sv + vp[pos].second);
    }
  }
  /*for(auto c : vp){
  	OUT(c.fir, c.sec);
  }*/
  cout << res << endl;
  //cout << fixed << setprecision(15) << ans << endl;
  return 0;
}
