n = int(input().split()[0])
c = sorted(filter(lambda x:x <= n,map(int,input().split())))

minimum = [ i for i in range(n+1) ]
for i in c:
    minimum[i] = 1

for i in range(2,n+1):
    for j in c:
        if j > i:
            break
        if minimum[i-j] + 1 < minimum[i]:
            minimum[i] = minimum[i-j]+1

print(minimum[n]) n = int(input().split()[0]) n int(input().split()[0]) int input().split()[0] ().split() ().split () input split 0 c = sorted(filter(lambda x:x <= n,map(int,input().split()))) c sorted(filter(lambda x:x <= n,map(int,input().split()))) sorted filter(lambda x:x <= n,map(int,input().split())) filter lambda x:x <= n x <= n x n x 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 minimum = [ i for i in range(n+1) ] minimum [ i for i in range(n+1) ] for i in c:
    minimum[i] = 1 i c minimum[i] = 1 minimum[i] minimum i 1 for i in range(2,n+1):
    for j in c:
        if j > i:
            break
        if minimum[i-j] + 1 < minimum[i]:
            minimum[i] = minimum[i-j]+1 i range(2,n+1) range 2 n+1 n 1 for j in c:
        if j > i:
            break
        if minimum[i-j] + 1 < minimum[i]:
            minimum[i] = minimum[i-j]+1 j c if j > i:
            break
         j > i j i break if minimum[i-j] + 1 < minimum[i]:
            minimum[i] = minimum[i-j]+1 minimum[i-j] + 1 < minimum[i] minimum[i-j] + 1 minimum[i-j] minimum i-j i j 1 minimum[i] minimum i minimum[i] = minimum[i-j]+1 minimum[i] minimum i minimum[i-j]+1 minimum[i-j] minimum i-j i j 1 print(minimum[n]) print minimum[n] minimum n minimum = [ i for i in range(n+1) ] [ i for i in range(n+1) ] minimum c = sorted(filter(lambda x:x <= n,map(int,input().split()))) sorted(filter(lambda x:x <= n,map(int,input().split()))) c n = int(input().split()[0]) int(input().split()[0]) n
n = int(input().split()[0])
c = sorted(filter(lambda x:x <= n,map(int,input().split())))

minimum = [ i for i in range(n+1) ]
for i in c:
    minimum[i] = 1

for i in range(2,n+1):
    for j in c:
        if j > i:
            break
        if minimum[i-j] + 1 < minimum[i]:
            minimum[i] = minimum[i-j]+1

print(minimum[n])