#include<bits/stdc++.h>
using namespace std;

int main() {
	int N; cin >> N;
	int A[N+1], B[N];
	for(int i = 0; i < N+1; i++) cin >> A[i];
	for(int i = 0; i < N; i++) cin >> B[i];

	long long res = 0;
	for (int i = 0; i < N; i++)
	{
		res += min(A[i] + A[i+1], B[i]);
		if(A[i] + A[i+1] <= B[i]) A[i+1] = 0;
		else A[i+1] -= max(0, B[i] - A[i]);
	}
	cout << res << endl;
	return 0;
}
