function Main(input) {
    var N = parseInt(input[0])
    var D = []
    for(var i = 0; i< 5; i++) {
        D.push(parseInt(input[i+1]));
    }
    
    var time = [];
    var sum = Math.ceil(N / D[0]);
    time.push(sum);
    for (var i = 1; i < 5; i++){
        if( D[i] >= D[i-1]) {
            time.push(1);
        } else {
            time.push(Math.ceil(time[i-1] * (D[i-1] - D[i]) / D[i]));
        }
        sum += time[i];
    }
    
    console.log(sum);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));