process.stdin.resume();
process.stdin.setEncoding('utf8');


process.stdin.on('data', function (chunk) {
    let n = chunk.toString() // 文字列化する
        .split("\n") // \nで分割
        .map(x => Number(x))
        .filter(x => x !== 0);

    let roop1 = true;
    let kokugoday = 0;
    let roop2 = true;
    let sansuday = 0;
    let kekka1 = n[1] - n[3];
    let kekka2 = n[2] - n[4];;
    while (roop1) {
        kekka1 = kekka1 - n[3];
        kokugoday += 1;
        if (kekka1 <= 0) {
            roop1 = false;
            kokugoday += 1;
        }
    }

    while (roop2) {
        kekka2 = kekka2 - n[4];
        sansuday += 1;
        if (kekka2 <= 0) {
            roop2 = false;
            sansuday += 1;

        }
    }
    if (kokugoday <= sansuday) {
        const ans = n[0]-sansuday;
        console.log(ans);
    }else if(kokugoday >= sansuday){
        const ans = n[0]-kokugoday;
        console.log(ans);
    }


});
