n = int(input().split()[0])
c = list(map(int,input().split()))
dp = [ i for i in range(n+1) ]

for i in range(2,n+1):
    c2 = filter(lambda n:n<=i,c)
    for j in c2:
        if j <= i and dp[i-j] + 1 < dp[i]:
            dp[i] = dp[i-j] + 1

print(dp[n]) n = int(input().split()[0]) n int(input().split()[0]) int input().split()[0] ().split() ().split () input split 0 c = list(map(int,input().split())) c list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split i for i in range(n+1) for i in range(n+1) i range(n+1) range n+1 n 1 for i in range(n+1) i dp = [ i for i in range(n+1) ] dp [ i for i in range(n+1) ] for i in range(2,n+1):
    c2 = filter(lambda n:n<=i,c)
    for j in c2:
        if j <= i and dp[i-j] + 1 < dp[i]:
            dp[i] = dp[i-j] + 1 i range(2,n+1) range 2 n+1 n 1 c2 = filter(lambda n:n<=i,c) c2 filter(lambda n:n<=i,c) filter lambda n:n<=i n<=i n i n c for j in c2:
        if j <= i and dp[i-j] + 1 < dp[i]:
            dp[i] = dp[i-j] + 1 j c2 if j <= i and dp[i-j] + 1 < dp[i]:
            dp[i] = dp[i-j] + 1 j <= i and dp[i-j] + 1 < dp[i] j <= i j i dp[i-j] + 1 < dp[i] dp[i-j] + 1 dp[i-j] dp i-j i j 1 dp[i] dp i dp[i] = dp[i-j] + 1 dp[i] dp i dp[i-j] + 1 dp[i-j] dp i-j i j 1 print(dp[n]) print dp[n] dp n c2 = filter(lambda n:n<=i,c) filter(lambda n:n<=i,c) c2 dp = [ i for i in range(n+1) ] [ i for i in range(n+1) ] dp n = int(input().split()[0]) int(input().split()[0]) n c = list(map(int,input().split())) list(map(int,input().split())) c
n = int(input().split()[0])
c = list(map(int,input().split()))
dp = [ i for i in range(n+1) ]

for i in range(2,n+1):
    c2 = filter(lambda n:n<=i,c)
    for j in c2:
        if j <= i and dp[i-j] + 1 < dp[i]:
            dp[i] = dp[i-j] + 1

print(dp[n])