import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    auto n = lread();
    auto a = aryread();
    auto b = aryread();
    // writeln(a);
    // writeln(b);
    long cnt;
    long tmp;
    long tmptmp;
    foreach (i; 0 .. n)
    {
        tmp = min(a[i], b[i]);
        cnt += tmp;
        a[i] -= tmp;
        b[i] -= tmp;
        // writeln("a:", a);
        // writeln("b:", b);
        // writeln(cnt);

        tmptmp = min(a[i + 1], b[i]);
        cnt += tmptmp;
        a[i + 1] -= tmptmp;
        b[i] -= tmptmp;
        // writeln("a:", a);
        // writeln("b:", b);

    }
    writeln(cnt);

}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}
