N, W = list(map(int, input().split()))

goods = [list(map(int, input().split())) for i in range(N)]

v_sum = sum([i[1] for i in goods])

dp = [float("inf") for i in range(v_sum + 1)]

dp[0] = 0

for i in range(N):

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

        dp[j] = min(dp[j - goods[i][1]] + goods[i][0], dp[j])



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

    if dp[i] <= W:

        print(i)

        break

N, W = list(map(int, input().split()))



items = [list(map(int, input().split())) for _ in range(N)]

v_sum = sum([item[1] for item in items])



inf = float("inf")

dp = [inf for _ in range(v_sum + 1)]



dp[0] = 0

for i in range(N):

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

        if dp[j] > dp[j - items[i][1]] + items[i][0]:

            dp[j] = dp[j - items[i][1]] + items[i][0]



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

    if dp[i] <= W:

        print(i)

        exit()

N, W = list(map(int, input().split()))
goods = [list(map(int, input().split())) for i in range(N)]
v_sum = sum([i[1] for i in goods])
dp = [float("inf") for i in range(v_sum + 1)]
dp[0] = 0
for i in range(N):
    for j in range(v_sum, -1, -1):
        dp[j] = min(dp[j - goods[i][1]] + goods[i][0], dp[j])
for i in range(v_sum, -1, -1):
    if dp[i] <= W:
        print(i)
        break

N, W = list(map(int, input().split()))
items = [list(map(int, input().split())) for _ in range(N)]
v_sum = sum([item[1] for item in items])
inf = float("inf")
dp = [inf for _ in range(v_sum + 1)]
dp[0] = 0
for i in range(N):
    for j in range(v_sum, -1, -1):
        if dp[j] > dp[j - items[i][1]] + items[i][0]:
            dp[j] = dp[j - items[i][1]] + items[i][0]
for i in range(v_sum, -1, -1):
    if dp[i] <= W:
        print(i)
        exit()

-goods = [list(map(int, input().split())) for i in range(N)] -v_sum = sum([i[1] for i in goods]) -dp = [float("inf") for i in range(v_sum + 1)] +items = [list(map(int, input().split())) for _ in range(N)] +v_sum = sum([item[1] for item in items]) +inf = float("inf") +dp = [inf for _ in range(v_sum + 1)] -        dp[j] = min(dp[j - goods[i][1]] + goods[i][0], dp[j]) +        if dp[j] > dp[j - items[i][1]] + items[i][0]: +            dp[j] = dp[j - items[i][1]] + items[i][0] -        break +        exit()