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 <climits>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define DEBUG(x) cerr << #x << ": " << x << "\n"

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    const int MAX_N = 40;
    const long INF = 1 << 20;
    int N;
    ll W, v[MAX_N], w[MAX_N];
    vector<pair<ll, ll> > p;  // (weight, value)
    cin >> N >> W;
    REP(i, N) {
        cin >> v[i] >> w[i];
    }
    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];
            }
        }
        p.push_back(make_pair(sw, sv));
    }
    SORT(p);
    int m = 1;
    FOR(i, 1, 1 << N2) {
        if (p[m - 1].second < p[i].second) {
            p[m] = p[i];
            ++m;
        }
    }
    ll res = 0;
    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) {
            pair<ll, ll> _p = make_pair(W - sw, INF);
            ll tv = (lower_bound(p.begin(), p.begin() + m, _p) - 1)->second;
            res = max(res, sv + tv);
        }
    }
    cout << res << endl;
    return 0;
}

