import std.stdio;
import std.conv;
import std.array;

void main()
{
    int N = readln.split[0].to!int;
    auto reader = readln.split;
    int[] A = new int[N + 1];
    for(uint i = 0; i < N + 1; i++){
        A[i] = reader[i].to!int;
    }
    reader = readln.split;
    int[] B = new int[N];
    for(uint i = 0; i < N; i++){
        B[i] = reader[i].to!int;
    }

    ulong ans = 0;
    for (uint i = 0; i < N; i++){
        ans += battle(A[i], B[i]);
        ans += battle(A[i + 1], B[i]);
    }
    
    writeln(ans);
}

int battle(ref int a, ref int b){
    int ret;

    if (b > a){
        ret = a;
        b -= a;
        a = 0;
    } else {
        ret = b;
        a -= b;
        b = 0;
    }
    
    return ret;
}
