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

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

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

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

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

print(minimum[n])