import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

long calc(int n, int[] a, int[] b) {
    long ans = 0;
    for (int i = 0; i < n; i++) {
        int d = min(a[i], b[i]);
        ans += d;
        if (a[i] < b[i]) {
            int d2 = min(a[i+1], b[i] - a[i]);
            a[i+1] -= d2;
            ans += d2;
        }
    }
    return ans;
}

void main() {
    int n; scan(n);
    auto a = readints;
    auto b = readints;
    writeln(calc(n, a, b));
}
