import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

void main()
{
    int n;
    readf("%s", &n);
    readln;
    
    auto a = readln.chomp.split.map!(to!int).array;

    auto b = readln.chomp.split.map!(to!int).array;
    
    long ans = 0;
    foreach (i, e; b) {
        int now = min(a[i], b[i]);
        ans += now;
        a[i] -= now;
        b[i] -= now;
        
        now = min(a[i+1], b[i]);
        ans += now;
        a[i+1] -= now;
        b[i] -= now;
    }
    
    ans.writeln;
}