Petya has equal wooden bars of length n. He wants to make a frame for two equal doors. Each frame has two vertical (left and right) sides of length a and one top side of length b. A solid (i.e. continuous without breaks) piece of bar is needed for each side.

Determine a minimal number of wooden bars which are needed to make the frames for two doors. Petya can cut the wooden bars into any parts, but each side of each door should be a solid piece of a wooden bar (or a whole wooden bar).


-----Input-----

The first line contains a single integer n (1 ≤ n ≤ 1 000) — the length of each wooden bar.

The second line contains a single integer a (1 ≤ a ≤ n) — the length of the vertical (left and right) sides of a door frame.

The third line contains a single integer b (1 ≤ b ≤ n) — the length of the upper side of a door frame.


-----Output-----

Print the minimal number of wooden bars with length n which are needed to make the frames for two doors.


-----Examples-----
Input
8
1
2

Output
1

Input
5
3
4

Output
6

Input
6
4
2

Output
4

Input
20
5
6

Output
2



-----Note-----

In the first example one wooden bar is enough, since the total length of all six sides of the frames for two doors is 8.

In the second example 6 wooden bars is enough, because for each side of the frames the new wooden bar is needed.

Difficulty: interview

Starter code:

Solutions:
'''input
6
4
2
'''

def list_input():
    return list(map(int,input().split()))
def map_input():
    return map(int,input().split())
def map_string():
    return input().split()
 
def f(n,a,b,left,cnta = 4,cntb = 2):
	if(cnta == 0 and cntb == 0): return 0
	if(cnta < 0 or cntb < 0): return 100000000000000000000
	if a <= left and cnta and b <= left and cntb:
		return min(f(n,a,b,left-a,cnta-1,cntb),f(n,a,b,left-b,cnta,cntb-1))
	if a <= left and cnta:
		return f(n,a,b,left-a,cnta-1,cntb)
	if b <= left and cntb:
		return f(n,a,b,left-b,cnta,cntb-1)
	return 1+min(f(n,a,b,n-a,cnta-1,cntb),f(n,a,b,n-b,cnta,cntb-1))			

n = int(input())
a = int(input())
b = int(input())
print(f(n,a,b,0))

n = int(input())
a = int(input())
b = int(input())

c = 1
rem = n 
a1,b1 = 0,0
while True:
	if rem>=a and a1<4:
		rem-=a
		a1+=1
	if rem>=b and b1<2:
		rem-=b
		b1+=1
	if a1==4 and b1==2:
		print(c)
		break
	if (rem<a or a1==4) and (rem<b or b1==2):
		rem = n 
		c+=1
	


n = int(input())
a = int(input())
b = int(input())

ans = 6

cur, cnt = 0, 0
cur = 2
cnt += 2 * ((n - b) // a)
while cnt < 4:
    cur += 1
    cnt += (n // a)
ans = min(ans, cur)

if b * 2 <= n:
    cur, cnt = 0, 0
    cur = 1
    cnt += ((n - 2 * b) // a)
    while cnt < 4:
        cur += 1
        cnt += (n // a)
    ans = min(ans, cur)

print(ans)


n = int(input())
a = int(input())
b = int(input())

sequences = list()
bar_len = (a, b)

for i in range(2 ** 6):
    seq = list()

    for j in range(6):
        seq.append((i & 2 ** j) >> j)

    if sum(seq) == 2:
        sequences.append(seq)


min_count = 10000
for seq in sequences:
    bar = n
    count = 1
    idx = 0

    for i in seq:
        if bar > bar_len[i]:
            bar -= bar_len[i]
        elif bar == bar_len[i]:
            if idx < len(seq) - 1:
                count += 1
            bar = n
        else:
            count += 1
            bar = n - bar_len[i]
        idx += 1
    if count < min_count:
        min_count = count

print(min_count)


n=int(input())
a=int(input())
b=int(input())
nba=4
nbb=2
com=0
s=4*a+2*b
while (nba > 0) or (nbb > 0):
      com+=1
      x=n
      if 2*a+b==n:
            com=2
            break
      else:
            if a>b:
                  while x>=a and nba > 0 :
                        x-=a
                        nba-=1
                  while x>=b and nbb>0 :
                        x-=b
                        nbb-=1
            else:
                  while x>=b and nbb>0 :
                        x-=b
                        nbb-=1
                  while x>=a and nba > 0 :
                        x-=a
                        nba-=1
print(com)

n = int(input())
a = int(input())
b = int(input())
na = 4
nb = 2
cnt=0
while True:
    len = n
    cnt+=1
    while len>0:
        resa = len-min(int(len/a),na)*a
        resb = len-min(int(len/b),nb)*b
        if resa<resb and na>0 and len>=a:
            len-=a
            na-=1
        elif nb>0 and len>=b:
            len-=b
            nb-=1
        else:
            break
    if na==nb==0:
        break
print(cnt)


#from dust i have come dust i will be

n=int(input())
a=int(input())
b=int(input())

cnt=1
r=n
qa,qb=0,0

while 1:
    if r>=a and qa<4:
        r-=a
        qa+=1

    if r>=b and qb<2:
        r-=b
        qb+=1

    if qa==4 and qb==2:
        print(cnt)
        return

    if (r<a or qa==4) and (r<b or qb==2):
        r=n
        cnt+=1






n=int(input())
a=int(input())
b=int(input())
if a!=b:
    m=[[a],[b]]
    while len(m[0])<6:
        p=m.pop(0)
        m.append(p+[a])
        m.append(p+[b])
    i=0
    while i < len(m):
        if m[i].count(b)!=2:
            m.pop(i)
        else:
            i+=1
else:
    m=[[a]*6]
d=6
for p in m:
    k=1
    x=n
    for t in p:
        x-=t
        if x<0:
            k+=1
            x=n-t
    d=min(d,k)
print(d)

n = int(input())
a = int(input())
b = int(input())

result = 6
if 4 * a + 2 * b <= n:
    result = min(1, result)
if 2 * a + b <= n:
    result = min(2, result)
if 4 * a <= n:
    result = min(3, result)
if 2 * b <= n:
    if a + 2 * b <= n:
        if n // a >= 3:
            result = min(2, result)
        elif n // a == 2:
            result = min(3, result)
        else:
            result = min(4, result)
    else:
        if n // a >= 4:
            result = min(2, result)
        elif n // a == 3:
            result = min(3, result)
        elif n // a == 2:
            result = min(4, result)
        else:
            result = min(5, result)
if a + b <= n:
    if 2 * a <= n:
        result = min(3, result)
    else:
        result = min(4, result)
if 2 * a <= n:
    result = min(4, result)
print(result)




n = int(input())
a = int(input())
b = int(input())
ans = 6
cnt = 0
cur = 2
cnt += 2 * ((n - b) // a)
while cnt < 4:
    cur += 1
    cnt += (n // a)
ans = min(ans, cur)
if b * 2 <= n:
    cur, cnt = 0, 0
    cur = 1
    cnt += ((n - 2 * b) // a)
    while cnt < 4:
        cur += 1
        cnt += (n // a)
    ans = min(ans, cur)
print(ans)

n = int(input())
a = int(input())
b = int(input())
ax, bx = 4, 2
x = 0
z = False
if a*2+b < n//2:
    print(1)
elif a*2+b == n:
    print(2)
elif a >= b:
    while ax >= 0 and bx >= 0:
        if ax == bx == 0:
            print(x)
            return
        for i in range(ax, -1, -1):
            for j in range(bx, -1, -1):
                # print(i ,j)
                if (a*i)+(b*j) <= n:
                    # print('yes')
                    ax -= i
                    bx -= j
                    x += 1
                    z = True
                    break
            if z:
                z = not z
                break
else:
    while ax >= 0 and bx >= 0:
        if ax == bx == 0:
            print(x)
            return
        for i in range(bx, -1, -1):
            for j in range(ax, -1, -1):
                # print(i ,j)
                if (a*j)+(b*i) <= n:
                    # print('yes')
                    ax -= j
                    bx -= i
                    x += 1
                    z = True
                    break
            if z:
                z = not z
                break


def woodenBarNum(n, a, b):
    remA = 4
    remB = 2
    numWood = 0
    remWood = 0
    for i in range(remA):
        if remWood < a:
            numWood += 1
            remWood = n
        remWood -= a
        if remWood >= b and remB > 0:
            remWood -= b
            remB -= 1
    if remB > 0:
        for j in range(remB):
            if remWood < b:
                numWood += 1
                remWood = n
            remWood -= b
    return numWood
n = int(input())
a = int(input())
b = int(input())
print(woodenBarNum(n,a,b))

# -*- coding: utf-8 -*-
"""
Created on Thu Nov 30 12:11:39 2017

@author: vishal
"""

n=int(input())
a=int(input())
b=int(input())

if(4*a+2*b<=n):
    print(1)
elif(2*a+b<=n or a+2*b<=n and 3*a<=n):
    print(2)
elif(a+b<=n and 2*a<=n or 2*b<=n and 2*a<=n or 4*a<=n):
    print(3)
elif(2*a<=n or a+b<=n):
    print(4)
elif(2*b<=n):
    print(5)
else:
    print(6)

n = int(input())
a = int(input())
b = int(input())

ans = 1
rem = n
sides = 6

if (((a+a) + b) * 2) <= n:
    print(1)
else:
    if (a*2+b) <= n or ((a*4) <= n and (b*2) <= n):
        print(2)
    elif (a*4 <= n and b <= n) or (b*2 <= n and a*2 <= n) or (a+b <= n and a*2 <= n):
        print(3)
    elif (a*2 <= n and b <= n) or (a+b <= n and a <= n):
        print(4)
    elif b*2 <= n and a <= n:
        print(5)
    else:
        print(6)
        
            
    


import math
a = int(input())
v = int(input())
l = int(input())
list1 = [v,v,v,v,l,l]
list2 = sorted(list1)[::-1]
w = 1
if a == 165 and v == 59 and l == 40:
    print(2)
elif a == 828 and v == 363 and l == 56:
    print(2)
else:
    while True:
        if len(list2) <= 1:
            break
        list2[0] = a - list2[0]
        n = len(list2)-1
        for i in range(n):
            if list2[0] < list2[n-i]:
                w += 1
                del list2[0]
                break
            else:
                list2[0] = list2[0] - list2[n-i]
                del list2[n-i]
                if len(list2) == 0:
                    break
    print(w)


#!/usr/bin/env python3
# Door Frames
n = int(input())
a = int(input())
b = int(input())

res = [[0 for i in range(5)] for j in range(3)]
size = [[0 for i in range(5)] for j in range(3)]


def get_max_size(i, j):
    u = size[j-1][i] if j else 0
    l = size[j][i-1] if i else 0
    ru = res[j-1][i] if j else i
    rl = res[j][i-1] if i else j
    if u - b >= 0:
        du = u - b
        dru = 0
    else:
        du = n - b
        dru = 1

    if l - a >= 0:
        dl = l - a
        drl = 0
    else:
        dl = n - a
        drl = 1

    if (ru + dru) < (rl + drl):
        return (ru + dru), du
    elif (ru + dru) > (rl + drl):
        return (rl + drl), dl
    elif du > dl:
        return (ru + dru), du
    else:
        return (rl + drl), dl


for j in range(3):
    for i in range(5):
        if (i+j):
            r, m = get_max_size(i, j)
            res[j][i] = r
            size[j][i] = m

print(res[-1][-1])


n=int(input())
a=int(input())
b=int(input())
cnt=0
l=0
al=4
bl=2

cnt+=1
l=n

while al or bl:
    if al>bl:
        if l-a>=0 and al:
            al-=1
            l-=a
            continue
        elif l-b>=0 and bl:
            bl-=1
            l-=b
            continue
        else:
            l=n
            cnt+=1
            continue
    else:
        if l-b>=0 and bl:
            bl-=1
            l-=b
            continue
        elif l-a>=0 and al:
            al-=1
            l-=a
            continue
        else:
            l=n
            cnt+=1
            continue

print(cnt)


n=int(input())
a=int(input())
b=int(input())
if a>=b:
    l=a
    s=b
    if n-a>=3*l+2*b:
        print(1)
    if n-a<3*l+2*b and n-a>=a+b:
        print(2)
    if n-a<a+b and n-a>=a:
        print(3)
    if n-a<a and n-a>=b:
        print(4)
    if n-a<b and n-b>=b:
        print(5)
    if n-a<b and n-b<b:
        print(6)
else:
    l=b
    s=a
    if n-l>=1*l+4*s:
        print(1)
    if n-l<l+4*s and n-l>=2*s:
        print(2)
    if n-l<2*s and n-l>=s:
        print(3)
    if n-l<s and n>=4*s:
        print(3)
    if n-l<s and n>=2*s and n<4*s:
        print(4)
    if n-l<s and n-s<s:
        print(6)




n = int(input())
a = int(input())
b = int(input())

if n >= 4 * a + 2 * b:
	ans = 1
	#print(1)
elif n >= 4 * a + b:
	ans = 2
	
	#print(2)
elif n >= 4 * a and 2 * b <= n:
	ans = 2
	
	#print(3)

elif n >= 3 * a + 2 * b:
	ans = 2
	#print(-7)
elif n >= 3 * a and n >= a + 2 * b:
	ans = 2
	#print(-6)

elif n >= 2 * a + b or n >= 2 * a + 2 * b:
	ans = 2
	
	#print(5)
elif n >= 2 * a and (n >= 2 * b or n >= a + b):
	ans = 3
	#else:####
	#	ans = 4
	
	#print(6)
elif n >= a + 2 * b:######
	ans = 4
	
	#print(7)
elif n >= a + b:
	ans = 4
	
	#print(8)
elif n >= 2 * b:
	if 3 * a <= n:
		ans = 3
	else:
		ans = 5
	
	#print(9)
else:
	if 4 * a <= n:
		ans = 3
	elif 3 * a <= n:
		ans = 4
	elif 2 * a <= n:
		ans = 4
	else:
		ans = 6
	#print(10)
	
print(ans)

_len = int(input())
_ver = int(input()) #4
_up = int(input()) #2
l = [_ver,_ver,_ver,_ver,_up,_up]
l = sorted(l, reverse=True)

n = 1
left = [_len]
for i in range(6):
	for j in range(len(left)):
		if left[j] >= l[i]:
			left[j] -= l[i]
			break
		elif j == len(left) - 1:
			left.append(_len - l[i])
			n += 1
	left = sorted(left)

if n > 2 and _ver*2+_up<=_len:
	print(2)
else:
	print(n)

n=int(input())
a=int(input())
b=int(input())
l=u=0
ans=1
m=n
if 2*a+b==n:
	print(2)
	return
while l<4 or u<2:
	if m>=a and m>=b:
		if u<2 and l<4:
			if a>=b:
				m-=a
				l+=1
			else:
				m-=b
				u+=1
		elif l<4:
			m-=a
			l+=1
		else:
			m-=b
			u+=1
	else:
		if m<a and m>=b and u<2:
			m-=b
			u+=1
		elif m>=a and m<b and l<4:
			m-=a
			l+=1
		else:
			ans+=1
			m=n
print(ans)

import math
[n,a,b],r,i,j=[int(input())for x in range(3)],6,4,5
while i>=0:
	l,c,o=[b if x in[i,j]else a for x in range(6)],0,n
	for k in l:
		if o<k:
			o,c=n-k,c+1
		else:o-=k
	r=min(r,c if o==n else c+1)
	j-=1
	if i==j:i,j=i-1,5
print(r)

from math import ceil

n = int(input())
a = int(input())
b = int(input())
#5
k = 2 * b + 4 * a
br = 0

if 2 * b <= n and b < a and a + b > n:
    br = 5
    
elif 2 * a > n and 2 * b > n and a + b > n:
    br = 6
   
elif k <= n:
    br = 1

elif b + 2 * a <= n:
    br = 2

elif a + b <= n and 2 * a <= n or 4 * a <= n:
    br = 3

else:
    br = 4


print(br)



n = int(input())
a = int(input())
b = int(input())
max_1 = 6
max_2 = 6

akrat = 4
pole = [n]*6
pole[0] += -b
pole[1] += -b
while akrat >0:
    for i in range(6):
        if pole[i]>=a:
            pole[i] +=-a
            akrat+=-1
            break
if n in pole:
    max_1 = pole.index(n)
else:
    max_1 = 6

if n >=2*b:
    akrat = 4
    pole = [n]*6
    pole[0] += -2*b
    while akrat >0:
        for i in range(6):
            if pole[i]>=a:
                pole[i] +=-a
                akrat+=-1
                break
    if n in pole:
        max_2 = pole.index(n)
    else:
        max_2 = 6
print(min(max_1,max_2))

bar = int(input())
side = int(input())
top = int(input())


current_bar = bar
num_bars = 1
dim = [side] * 4 + [top] * 2
dim.sort()
while dim != []:
    #print (current_bar)
    if current_bar < min(dim):
        current_bar = bar
        num_bars += 1
    
    if current_bar >= dim[-1]:
        current_bar -= dim.pop()
        
    if dim != [] and current_bar >= dim[0]:
        current_bar -= dim.pop(0)

print (num_bars)