"use strict"
function main(arg) {
    var machiKazu = parseInt(arg.trim().split("\n")[0]);
    var monster = arg.trim().split("\n")[1].split(" ");
    var yusya = arg.trim().split("\n")[2].split(" ");

    var kill = 0;
    monster.push(0);

    for(var i = 0; i < machiKazu; i++){
        first = parseInt(monster[i]);
        second = parseInt(monster[(i + 1)]);
        if(first < yusya[i]){
        kill = parseInt(kill + first);
        yusya[i] = parseInt(yusya[i] - first);
        }else{
            kill = parseInt(kill + yusya[i]);
            yusya[i] = 0;
        }
        if(yusya[i] != 0){
            if(second < yusya[i]){
                kill = parseInt(kill + second);
                monster[(i + 1)] = 0;
            }else{
                kill = parseInt(kill + yusya[i]);
                monster[(i + 1)] = parseInt(second - yusya[i]);
            }
        }
    }
    
       console.log(kill);


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