function main(input) {
    var n = input[0]-0;
    var a = input[1].split(" ").map(v=>v-0);
    var b = input[2].split(" ").map(v=>v-0);
    
    var ans = 0;
    for(var i=0;i<n;i++){
        var bb = b[i];
        var a1 = a[i];
        var a2 = a[i+1];
        if(a1<bb){
            a[i]-=a1;
            ans += a1;
            bb-=a1;
            if(a2<bb){
                a[i+1]-=a2;
                ans+=a2;
            }else{
                a[i+1]-=bb;
                ans+=bb;
            }
        }else{
            a[i]-=bb;
            ans += bb;
        }
    }
        console.log(ans);
    
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))
