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: MEDIUM_HARD
Tags: Implementation

Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
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))


import sys
n = int(sys.stdin.readline().strip())
am = int(sys.stdin.readline().strip())
bm = int(sys.stdin.readline().strip())

def recurse(a, b):
	global n
	pairs = set()
	if a <= 0 and b <= 0:
		return 0
	for i in range(0, a + 1):
		for j in range(0, b + 1):
			pairs.add((i, j))
	woods = 1
	answer = float('inf')
	for (i, j) in pairs:
		if n >= am * i + bm * j and am * i + bm * j is not 0:
			rec = recurse(a - i, b - j)
			answer = min(answer, rec)
	return woods + answer
print(recurse(4, 2))


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())
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
	elif 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)


n = int(input())
a = int(input())
b = int(input())
l = [a, a, a, a, n]
l.sort()
cur = 0
ans = 0
e = []
for i in range(5):
	cur += l[i]
	if cur > n:
		e.append(cur - l[i])
		cur = l[i]
		ans += 1
e.sort()
i = 0
c = 0
e.append(0)
e.append(0)
while i < len(e):
	if n - e[i] >= b:
		c += 1
		e[i] += b
	else:
		i += 1
	if c == 2:
		break
c = 0
if e[-1] == 0:
	c = 1
if e[-2] == 0:
	c += 1
u = len(e) - c
c = 0
(a, b) = (b, a)
l = [a, a, n]
l.sort()
cur = 0
ans = 0
e = []
for i in range(3):
	cur += l[i]
	if cur > n:
		e.append(cur - l[i])
		cur = l[i]
		ans += 1
e.sort()
i = 0
c = 0
e.append(0)
e.append(0)
e.append(0)
e.append(0)
while i < len(e):
	if n - e[i] >= b:
		c += 1
		e[i] += b
	else:
		i += 1
	if c == 4:
		break
c = 0
if e[-1] == 0:
	c = 1
if e[-2] == 0:
	c += 1
if e[-3] == 0:
	c += 1
if e[-4] == 0:
	c += 1
(a, b) = (b, a)
if 2 * a + b == n:
	u = 2
if 4 * a + 2 * b == n:
	u = 1
print(min(u, len(e) - c))


import os
import sys
import math
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
a = int(input())
b = int(input())
c1 = 4
c2 = 2
ch = 0
rem = 0
count = 0
j = 4
k = 2
if b > a:
	for i in range(2):
		s = min(n // b, c2)
		c2 -= s
		rem = n - s * b
		c1 -= rem // a
		if c2 <= 0:
			count = i + 1
			break
	for i in range(4):
		if c1 <= 0:
			count += i
			ch = 1
			break
		c1 -= n // a
	if ch == 0:
		count += 4
	j = 0
	k = 0
for i in range(j):
	s = min(n // a, c1)
	c1 -= s
	rem = n - s * a
	c2 -= rem // b
	if c1 <= 0:
		count = i + 1
		break
for i in range(k):
	if c2 <= 0:
		count += i
		ch = 1
		break
	c2 -= n // b
if ch == 0 and a >= b:
	count += 2
if 2 * a + b == n:
	count = 2
print(count)


from sys import stdin, stdout
import math

def brute(n, bar, a, b, a_count, b_count):
	first = float('inf')
	second = float('inf')
	third = float('inf')
	fourth = float('inf')
	if a_count == 4 and b_count == 2:
		return 1
	if bar >= a and a_count < 4:
		first = brute(n, bar - a, a, b, a_count + 1, b_count)
	if bar >= b and b_count < 4:
		second = brute(n, bar - b, a, b, a_count, b_count + 1)
	if bar < a and a_count < 4:
		third = 1 + brute(n, n, a, b, a_count, b_count)
	if bar < b and b_count < 2:
		fourth = 1 + brute(n, n, a, b, a_count, b_count)
	return min(first, second, third, fourth)
n = int(stdin.readline().strip())
a = int(stdin.readline().strip())
b = int(stdin.readline().strip())
a_count = 0
b_count = 0
print(brute(n, n, a, b, a_count, b_count))


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())
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)


def check(n, a, b, vertical, upper, bar, bars):
	if vertical == 0 and upper == 0:
		bars[bar - 1] = True
		return
	for i in range(vertical + 1):
		for j in range(upper + 1):
			if i + j > 0 and i * a + j * b <= n:
				check(n, a, b, vertical - i, upper - j, bar + 1, bars)
n = int(input())
a = int(input())
b = int(input())
bars = [False] * 6
check(n, a, b, 4, 2, 0, bars)
for i in range(6):
	if bars[i]:
		print(i + 1)
		break


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)


_len = int(input())
_ver = int(input())
_up = int(input())
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)


orig_n = int(input())
a = int(input())
b = int(input())
orders = ['bbaaaa', 'babaaa', 'baabaa', 'baaaba', 'baaaab', 'abbaaa', 'ababaa', 'abaaba', 'abaaab', 'aabbaa', 'aababa', 'aabaab', 'aaabba', 'aaabab', 'aaaabb']
m = 10
for order in orders:
	count = 1
	n = orig_n
	for elem in order:
		if elem == 'a':
			val = a
		else:
			val = b
		if n < val:
			n = orig_n
			count += 1
		n -= val
	m = min(m, count)
print(m)


x = int(input())
a = int(input())
b = int(input())
ans = 6
if a + b > x and 2 * b <= x and (2 * a > x):
	ans = 5
if a + b <= x and 2 * a >= x or (2 * b > x and 2 * a <= x):
	ans = 4
if 2 * a <= x and 2 * b <= x or (4 * a <= x and 2 * b > x) or (2 * a <= x and a + b <= x):
	ans = 3
if 2 * a + b <= x:
	ans = 2
if 4 * a + 2 * b <= x:
	ans = 1
print(ans)


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
	elif 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, a, b) = (int(input()), int(input()), int(input()))
queue = [(N, 1, 4, 2)]
res = 10000
while queue:
	(n, amount, x, y) = queue.pop()
	if x == 0 and y == 0:
		res = min(res, amount)
		continue
	if x > 0:
		if n >= a:
			queue.append((n - a, amount, x - 1, y))
		else:
			queue.append((N - a, amount + 1, x - 1, y))
	if y > 0:
		if n >= b:
			queue.append((n - b, amount, x, y - 1))
		else:
			queue.append((N - b, amount + 1, x, y - 1))
print(res)


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)
		exit(0)
	if (r < a or qa == 4) and (r < b or qb == 2):
		r = n
		cnt += 1


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)


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
	elif 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())
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))


from math import ceil
n = int(input())
a = int(input())
b = int(input())
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())
(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)
			exit()
		for i in range(ax, -1, -1):
			for j in range(bx, -1, -1):
				if a * i + b * j <= n:
					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)
			exit()
		for i in range(bx, -1, -1):
			for j in range(ax, -1, -1):
				if a * j + b * i <= n:
					ax -= j
					bx -= i
					x += 1
					z = True
					break
			if z:
				z = not z
				break


n = int(input())
a = int(input())
b = int(input())
res = 6
if 2 * b <= n and 2 * a > n and (a + b > n):
	res = 5
if 2 * a <= n or a + b <= n:
	res = 4
if 2 * a <= n and (2 * b <= n or a + b <= n) or 4 * a <= n:
	res = 3
if 2 * a + b <= n:
	res = 2
if 4 * a + 2 * b <= n:
	res = 1
print(res)


m = int(input())
a = int(input())
b = int(input())
c = 1
n = m
ca = 0
cb = 0
if a * 2 + b == m:
	print(2)
	exit()
while ca + cb <= 6:
	if a <= n and n < b and (ca < 4):
		ca = ca + 1
		n = n - a
	if b <= n and n < a and (cb < 2):
		cb = cb + 1
		n = n - b
	if a <= n and b <= n and (ca < 4):
		ca = ca + 1
		n = n - a
	if a <= n and b <= n and (cb < 2):
		cb = cb + 1
		n = n - b
	if ca == 4 and cb == 2:
		break
	if n < a and n < b:
		n = m
		c = c + 1
	if n < a and b <= n and (cb == 2):
		n = m
		c = c + 1
	if n < b and a <= n and (ca == 4):
		n = m
		c = c + 1
print(c)


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)


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


from itertools import permutations
n = int(input())
a = int(input())
b = int(input())
res = 10 ** 10
for sides in permutations([a] * 4 + [b] * 2):
	curRes = 0
	rest = 0
	for side in sides:
		if side > rest:
			rest = n
			curRes += 1
		rest -= side
	res = min(res, curRes)
print(res)


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())
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)


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())
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)
	elif 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())
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])


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import Counter
import heapq
from collections import Counter
from bisect import bisect_right
n = int(input())
a = int(input())
b = int(input())
le = a * 4 + b * 2
if le <= n:
	print(1)
elif 2 * a + b <= n:
	print(2)
elif 2 * a > n and 2 * b > n and (a + b > n):
	print(6)
elif 2 * b <= n and a + b > n and (2 * a > n):
	print(5)
elif 4 * a <= n and b <= n or (a + b <= n and 2 * a <= n) or (2 * b <= n and 2 * a <= n):
	print(3)
else:
	print(4)


n = int(input())
a = int(input())
b = int(input())
cntA = 4
cntB = 2
ans = 0
ost = 0
while cntA > 0 or cntB > 0:
	ans = ans + 1
	ost = n
	myA = 0
	myB = 0
	minOst = n
	for i in range(0, cntA + 1):
		for j in range(0, cntB + 1):
			if a * i + b * j <= ost and ost - a * i - b * j < minOst:
				myA = i
				myB = j
				minOst = ost - a * i - b * j
	cntA = cntA - myA
	cntB = cntB - myB
print(ans)


(n, a, b) = [int(input()) for _ in range(3)]
d = [0]
c = 0
for i in (a, b, a, a, b, a):
	if max(d) >= i:
		d[d.index(max(d))] -= i
	else:
		c += 1
		d += [n - i]
print(c)


n = int(input())
a = int(input())
b = int(input())
cnt = 0
lenth = 0
cnt = 0
max_num = max(a, b)
min_num = min(a, b)
if max_num == a:
	max_cnt = 4
	min_cnt = 2
else:
	max_cnt = 2
	min_cnt = 4
rand_num = min_num
for i in range(6):
	if max_cnt == 0 and min_cnt == 0:
		break
	if lenth < rand_num:
		lenth = n
		if lenth % (2 * a + b) == 0:
			if lenth / (2 * a + b) == 1:
				cnt = 2
			else:
				cnt = 1
			break
		cnt += 1
	if lenth >= max_num and max_cnt > 0:
		lenth -= max_num
		max_cnt -= 1
	elif lenth >= min_num and min_cnt > 0:
		lenth -= min_num
		min_cnt -= 1
		if min_cnt == 0:
			rand_num = max_num
print(cnt)


bar = int(input())
side = int(input())
top = int(input())
current_bar = bar
num_bars = 1
dim = [side] * 4 + [top] * 2
dim.sort()
while dim != []:
	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)


n = int(input())
a = int(input())
b = int(input())
count = 0
x = 4
y = 2
while x != 0 or y != 0:
	mn = n
	cl = ()
	count += 1
	for i in range(x + 1):
		for j in range(y + 1):
			s = n - (i * a + j * b)
			if s >= 0 and s <= mn:
				mn = s
				cl = (i, j)
	x -= cl[0]
	y -= cl[1]
print(count)