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

void main() {
    ulong n = readln.strip.to!ulong;
    auto as = readln.strip.split.to!(ulong[]).array;
    auto bs = readln.strip.split.to!(ulong[]).array;
    ulong ans = 0;

    foreach (i; 0..n) {
        if (bs[i] >= as[i]) {
            ans += as[i];
            bs[i] -= as[i];

            if (bs[i] >= as[i+1]) {
                ans += as[i+1];
            }
            else {
                ans += bs[i];
                as[i+1] -= bs[i];
            }
        } else {
            ans += bs[i];
        }
    }

    writeln(ans);
}
