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
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n, w = ns()
    d = []
    for _ in range(n):
        vi, wi = ns()
        d.append([wi, vi])

    def allcase(array):
        res = [[0, 0]]
        for wi, vi in array:
            nxt = [[wi + wt, vi + vt] for wt, vt in res]
            res += nxt
        res.sort(key=lambda x: x[1])
        res.sort()

        maximum = -1
        tres = []

        for wi, vi in res:
            if vi > maximum:
                tres.append([wi, vi])
                maximum = vi

        return tres

    a = allcase(d[:n // 2])
    b = allcase(d[n // 2:])

    a_idx = len(a) - 1
    b_idx = 0
    ans = 0
    while a_idx > -1:
        a_idx -= 1
        b_idx = max(0, b_idx - 1)
        while len(b) > b_idx > -1:
            if a[a_idx][0] + b[b_idx][0] <= w:
                ans = max(ans, a[a_idx][1] + b[b_idx][1])
                b_idx += 1
            else:
                break

    print(ans)


if __name__ == '__main__':
    main()

