"use strict";

const main = arg => {

    const input = arg.trim().split("\n");

    const N = parseInt(input[0]);
    let as = input[1].trim().split(" ").map(e => parseInt(e));
    let bs = input[2].trim().split(" ").map(e => parseInt(e));

    let sum = 0;
    for (let i = 0; i < N; i++) {
        const left = Math.min(as[i], bs[i]);
        as[i] -= left;
        const right = Math.min(as[i + 1], bs[i] - left);
        as[i + 1] -= right;
        sum += left + right;
    }
    console.log(sum);
}

main(require("fs").readFileSync('/dev/stdin', 'utf-8'));