#https://atcoder.jp/contests/dp/tasks/dp_e

#2019-01-13

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

w, v = [], []

for i in range(N):

    a, b = list(map(int, input().split()))

    w += [a]

    v += [b]



DP = [float("inf")] * (N*1000+1)

DP[0] = 0

#総価値 i 円を得るために最低限必要な重量

for i in range(N):

    for j in range(N*1000,-1,-1):

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

ans = 0

for k in range(N*1000+1):

    if DP[k] <= W:

        

        ans = k

print(ans)
#https://atcoder.jp/contests/dp/tasks/dp_e

#2019-01-13

import numpy as np

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

w, v = [], []

for i in range(N):

    a, b = list(map(int, input().split()))

    w += [a]

    v += [b]



DP = np.ones(N*1000+1, dtype=int) *(W+1)

DP[0] = 0

#総価値 i 円を得るために最低限必要な重量

for i in range(N):

    DP[v[i]:] = np.minimum(DP[:-v[i]]+ w[i], DP[v[i]:])

ans = 0

for k in range(N*1000+1):

    if DP[k] <= W:

        ans = k

        

print(ans)
# https://atcoder.jp/contests/dp/tasks/dp_e
# 2019-01-13
N, W = list(map(int, input().split()))
w, v = [], []
for i in range(N):
    a, b = list(map(int, input().split()))
    w += [a]
    v += [b]
DP = [float("inf")] * (N * 1000 + 1)
DP[0] = 0
# 総価値 i 円を得るために最低限必要な重量
for i in range(N):
    for j in range(N * 1000, -1, -1):
        DP[j] = min(DP[j - v[i]] + w[i], DP[j])
ans = 0
for k in range(N * 1000 + 1):
    if DP[k] <= W:
        ans = k
print(ans)

# https://atcoder.jp/contests/dp/tasks/dp_e
# 2019-01-13
import numpy as np

N, W = list(map(int, input().split()))
w, v = [], []
for i in range(N):
    a, b = list(map(int, input().split()))
    w += [a]
    v += [b]
DP = np.ones(N * 1000 + 1, dtype=int) * (W + 1)
DP[0] = 0
# 総価値 i 円を得るために最低限必要な重量
for i in range(N):
    DP[v[i] :] = np.minimum(DP[: -v[i]] + w[i], DP[v[i] :])
ans = 0
for k in range(N * 1000 + 1):
    if DP[k] <= W:
        ans = k
print(ans)

+import numpy as np + -DP = [float("inf")] * (N * 1000 + 1) +DP = np.ones(N * 1000 + 1, dtype=int) * (W + 1) -    for j in range(N * 1000, -1, -1): -        DP[j] = min(DP[j - v[i]] + w[i], DP[j]) +    DP[v[i] :] = np.minimum(DP[: -v[i]] + w[i], DP[v[i] :])