import std.stdio, std.string, std.conv, std.algorithm;

void main() {
    int n = readln.chomp.to!int;
    long[] a = readln.split.to!(long[]);
    long[] b = readln.split.to!(long[]);
    long monster;
    foreach (i; 0 .. n) {
        if (a[i] < b[i]) {
            long c = min(a[i+1], b[i]-a[i]);
            a[i+1] -= c;
            monster += a[i] + c;
        } else {
            monster += b[i];
        }
    }
    monster.writeln;
}