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

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



dp = [[float('inf')]*(10**5+1) for i in range(n+1)]

dp[0][0] = 0



for i in range(1,n+1):

    for j in range(10**5+1):

        if j >= item[i-1][1]:

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

        else:

            dp[i][j] = dp[i-1][j]

for j in range(10**5+1):

    if dp[n][j] <= w:

        ans = j



print(ans)
INF = 10**18

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



dp = [[INF for i in range(10**5 + 1)] for j in range(N + 1)]

dp[0][0] = 0



for i in range(1, N + 1):

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

    for j in range(10**5 + 1):

        if j - v >= 0:

            dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - v] + w)

        else:

            dp[i][j] = dp[i - 1][j]



res = 0



for j in range(10**5 + 1):

    if dp[N][j] <= W:

        res = j



print(res)
n, w = list(map(int, input().split()))
item = [list(map(int, input().split())) for i in range(n)]
dp = [[float("inf")] * (10**5 + 1) for i in range(n + 1)]
dp[0][0] = 0
for i in range(1, n + 1):
    for j in range(10**5 + 1):
        if j >= item[i - 1][1]:
            dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - item[i - 1][1]] + item[i - 1][0])
        else:
            dp[i][j] = dp[i - 1][j]
for j in range(10**5 + 1):
    if dp[n][j] <= w:
        ans = j
print(ans)

INF = 10**18
N, W = list(map(int, input().split()))
dp = [[INF for i in range(10**5 + 1)] for j in range(N + 1)]
dp[0][0] = 0
for i in range(1, N + 1):
    w, v = list(map(int, input().split()))
    for j in range(10**5 + 1):
        if j - v >= 0:
            dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - v] + w)
        else:
            dp[i][j] = dp[i - 1][j]
res = 0
for j in range(10**5 + 1):
    if dp[N][j] <= W:
        res = j
print(res)

-n, w = list(map(int, input().split())) -item = [list(map(int, input().split())) for i in range(n)] -dp = [[float("inf")] * (10**5 + 1) for i in range(n + 1)] +INF = 10**18 +N, W = list(map(int, input().split())) +dp = [[INF for i in range(10**5 + 1)] for j in range(N + 1)] -for i in range(1, n + 1): +for i in range(1, N + 1): +    w, v = list(map(int, input().split())) -        if j >= item[i - 1][1]: -            dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - item[i - 1][1]] + item[i - 1][0]) +        if j - v >= 0: +            dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - v] + w) +res = 0 -    if dp[n][j] <= w: -        ans = j -print(ans) +    if dp[N][j] <= W: +        res = j +print(res)