"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0]);
    const A = arg[1].split(" ").map(n=>parseInt(n));
    const B = arg[2].split(" ").map(n=>parseInt(n));
    
    const sum = A.reduce((m,n)=>m+n);
    
    let cnt  = 0;
    let rest = 0;

    for(let i=0; i<N; i++) {
        if(A[i] >= B[i]) {
            cnt += B[i];
            continue;
        }
        
        let temp = B[i] - A[i];
        
        cnt += A[i];
        cnt += Math.min(temp, A[parseInt(i)+1]);
        
        A[parseInt(i)+1] = Math.max(A[parseInt(i)+1] - temp, 0);
    }
    
    console.log(cnt);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));