n, w = list(map(int, input().split()))



weight = []

value = []



for i in range(n):

    wi, vi = list(map(int, input().split()))

    weight.append(wi)

    value.append(vi)



v_sum = sum(value)



dp = [[float('inf') for _ in range(v_sum+1)] for i in range(n)]



for i in range(n):

    if i == 0:

        dp[i][0] = 0

        dp[i][value[0]] = weight[0]

    else:

        for k in range(v_sum+1):

            if k < value[i]:

                dp[i][k] = dp[i-1][k]

            else:

                dp[i][k] = min(dp[i-1][k], dp[i-1][k-value[i]]+weight[i])



for i in range(v_sum, -1, -1):

    if dp[n-1][i] <= w:

        print(i)

        exit()

n, w = list(map(int, input().split()))



weight = []

value = []



for i in range(n):

    wi, vi = list(map(int, input().split()))

    weight.append(wi)

    value.append(vi)



v_sum = sum(value)



dp = [[10**12 for _ in range(v_sum+1)] for i in range(n)]



for i in range(n):

    if i == 0:

        dp[i][0] = 0

        dp[i][value[0]] = weight[0]

    else:

        for k in range(v_sum+1):

            if k < value[i]:

                dp[i][k] = dp[i-1][k]

            else:

                dp[i][k] = min(dp[i-1][k], dp[i-1][k-value[i]]+weight[i])



for i in range(v_sum, -1, -1):

    if dp[n-1][i] <= w:

        print(i)

        exit()

n, w = list(map(int, input().split()))
weight = []
value = []
for i in range(n):
    wi, vi = list(map(int, input().split()))
    weight.append(wi)
    value.append(vi)
v_sum = sum(value)
dp = [[float("inf") for _ in range(v_sum + 1)] for i in range(n)]
for i in range(n):
    if i == 0:
        dp[i][0] = 0
        dp[i][value[0]] = weight[0]
    else:
        for k in range(v_sum + 1):
            if k < value[i]:
                dp[i][k] = dp[i - 1][k]
            else:
                dp[i][k] = min(dp[i - 1][k], dp[i - 1][k - value[i]] + weight[i])
for i in range(v_sum, -1, -1):
    if dp[n - 1][i] <= w:
        print(i)
        exit()

n, w = list(map(int, input().split()))
weight = []
value = []
for i in range(n):
    wi, vi = list(map(int, input().split()))
    weight.append(wi)
    value.append(vi)
v_sum = sum(value)
dp = [[10**12 for _ in range(v_sum + 1)] for i in range(n)]
for i in range(n):
    if i == 0:
        dp[i][0] = 0
        dp[i][value[0]] = weight[0]
    else:
        for k in range(v_sum + 1):
            if k < value[i]:
                dp[i][k] = dp[i - 1][k]
            else:
                dp[i][k] = min(dp[i - 1][k], dp[i - 1][k - value[i]] + weight[i])
for i in range(v_sum, -1, -1):
    if dp[n - 1][i] <= w:
        print(i)
        exit()

-dp = [[float("inf") for _ in range(v_sum + 1)] for i in range(n)] +dp = [[10**12 for _ in range(v_sum + 1)] for i in range(n)]