function main(input) {
    var args = input.trim().split(/\r\n|\n/);
    var N = Number(args[0].trim());
    var Ai = args[1].trim().split(" ").map(v => Number(v.trim()));
    var Bi = args[2].trim().split(" ").map(v => Number(v.trim()));

    var rest = 0;
    var wins = 0;
    for(var i = 0; Ai.length > i; i++) {
        if ((!!Bi[i] && Bi[i] + rest >= (Ai[i])) || rest >= (Ai[i])) {
            wins += Ai[i];
        } else {
            wins += !!Bi[i] ? Bi[i] + rest : rest;
        }

        var tempRest = 0;
        if (!!Bi[i]) {
            tempRest = Bi[i] - (Ai[i] - rest > 0 ? Ai[i] - rest : 0);
        }
        rest = tempRest > 0 ? tempRest : 0;
    }

    console.log(wins);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));