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

k=[[0,0] for i in range(N)]

dp=[[W+1]*(1001*101+1) for j in range(N+1)]

R=set()

for i in range(N):

    k[i][0],k[i][1]=list(map(int,input().split()))

dp[0][:k[0][1]]=[k[0][0]]*(k[0][1]+1)

dp[0][0]=0

for i in range(1,N):

    for v in range(1001*101):

        if v - k[i][1]>=0:

         dp[i][v] = min(dp[i-1][v-k[i][1]]+k[i][0],dp[i-1][v])

        else:

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



        if dp[i][v]<W:

             R.add(v)





for v in reversed(list(range(1001*101+1))):

    if dp[N-1][v]<=W:

        print(v)

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

k=[[0,0] for i in range(N)]

dp=[[W+1]*(1001*101+1) for j in range(N+1)]

R=set()

for i in range(N):

    k[i][0],k[i][1]=list(map(int,input().split()))

#dp[0][:k[0][1]]=[k[0][0]]*(k[0][1]+1)

dp[0][0]=0

for i in range(0,N):

    for v in range(1001*101):

        if v - k[i][1]>=0:

            dp[i+1][v] = min(dp[i][v-k[i][1]]+k[i][0],dp[i][v])

        else:

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



        if dp[i][v]<W:

             R.add(v)





for v in reversed(list(range(1001*101+1))):

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

        print(v)

        exit()
N, W = list(map(int, input().split()))
k = [[0, 0] for i in range(N)]
dp = [[W + 1] * (1001 * 101 + 1) for j in range(N + 1)]
R = set()
for i in range(N):
    k[i][0], k[i][1] = list(map(int, input().split()))
dp[0][: k[0][1]] = [k[0][0]] * (k[0][1] + 1)
dp[0][0] = 0
for i in range(1, N):
    for v in range(1001 * 101):
        if v - k[i][1] >= 0:
            dp[i][v] = min(dp[i - 1][v - k[i][1]] + k[i][0], dp[i - 1][v])
        else:
            dp[i][v] = min(dp[i - 1][v], dp[i][v])
        if dp[i][v] < W:
            R.add(v)
for v in reversed(list(range(1001 * 101 + 1))):
    if dp[N - 1][v] <= W:
        print(v)
        exit()

N, W = list(map(int, input().split()))
k = [[0, 0] for i in range(N)]
dp = [[W + 1] * (1001 * 101 + 1) for j in range(N + 1)]
R = set()
for i in range(N):
    k[i][0], k[i][1] = list(map(int, input().split()))
# dp[0][:k[0][1]]=[k[0][0]]*(k[0][1]+1)
dp[0][0] = 0
for i in range(0, N):
    for v in range(1001 * 101):
        if v - k[i][1] >= 0:
            dp[i + 1][v] = min(dp[i][v - k[i][1]] + k[i][0], dp[i][v])
        else:
            dp[i + 1][v] = min(dp[i + 1][v], dp[i][v])
        if dp[i][v] < W:
            R.add(v)
for v in reversed(list(range(1001 * 101 + 1))):
    if dp[N][v] <= W:
        print(v)
        exit()

-dp[0][: k[0][1]] = [k[0][0]] * (k[0][1] + 1) +# dp[0][:k[0][1]]=[k[0][0]]*(k[0][1]+1) -for i in range(1, N): +for i in range(0, N): -            dp[i][v] = min(dp[i - 1][v - k[i][1]] + k[i][0], dp[i - 1][v]) +            dp[i + 1][v] = min(dp[i][v - k[i][1]] + k[i][0], dp[i][v]) -            dp[i][v] = min(dp[i - 1][v], dp[i][v]) +            dp[i + 1][v] = min(dp[i + 1][v], dp[i][v]) -    if dp[N - 1][v] <= W: +    if dp[N][v] <= W: