function Main(input) {
    input = input.split("\n");
    N = Number(input[0])
    tmpi = input[1].split(" ");
    tmpj = input[2].split(" ");
    an = 0;
    for(i = 0; i < N; i++){
        yusha = Number(tmpj[i]);
        mons = Number(tmpi[i]);
        c = yusha - mons;
        if(c >= 0) an += mons;
        else an += yusha; 
        if(c <= 0) continue;
        d = Number(tmpi[i+1]) - c;
        if(d >= 0){an += c;tmpi[i+1] =d}
        else{an+=Number(tmpi[i+1]);tmpi[i+1] =0}
    }
    console.log(an);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
