function main(input) {
	var list = input.split("\n");
	var peo = +list[0];
	var a = +list[0];
	var b = 0;
	var c = 0;
	var d = 0;
	var e = 0;
	var f = 0;
	var time = 0;
	var loop = true;

	while (loop) {
		time ++;
		if(e > 0) {
			if(e - +list[5] >= 0) {
				f += +list[5];
				e -= +list[5];
			} else {
				f += e;
				e = 0;
			}
		}
		if(d > 0) {
			if(d - +list[4] >= 0) {
				e += +list[4];
				d -= +list[4];
			} else {
				e += d;
				d = 0;
			}
		}
		if(c > 0) {
			if(c - +list[3] >= 0) {
				d += +list[3];
				c -= +list[3];
			} else {
				d += c;
				c = 0;
			}
		}
		if(b > 0) {
			if(b - +list[2] >= 0) {
				c += +list[2];
				b -= +list[2];
			} else {
				c += b;
				b = 0;
			}
		}
		if(a > 0) {
			if(a - +list[2] >= 0) {
				b += +list[2];
				a -= +list[2];
			} else {
				b += a;
				a = 0;
			}
		}
		if(f === peo) loop = false;
	}
	console.log(time);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));