// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");
    // 数値の配列を作る
    const numList0 = input[0].split(' ').map(x => parseInt(x, 10));
    const N = numList0[0];
    const AList = input[1].split(' ').map(x => parseInt(x, 10));
    const BList = input[2].split(' ').map(x => parseInt(x, 10));

    var left = AList[0];
    var total = 0;
    for (var i = 0; i < N; i++) {
        var nextA = AList[i + 1];
        var B = BList[i];

        if (left >= B) {
            total += B;
          	left = nextA;
            continue;
        } 
        
        var sum = left + nextA;
        if (sum <= B) {
            total += sum;
            left = 0;
        } else {
            var sub = sum - B;
            total += B;
            left = sub;
        }
    }

    console.log(total);
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));