#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
	
	int N, tmp;
	vector<int> A;
	ll ans = 0;
	int k;
	
	cin >> N;
	for(int i=0; i<N+1; i++) {
		cin >> tmp;
		A.push_back(tmp);
	}
	for(int i=0; i<N; i++) {
		cin >> tmp;
		k = min(A[i] + A[i+1], tmp);
		A[i+1] -= max(k - A[i], 0);
		ans += k;
	}
	
	cout << ans << endl;
	
	return 0;
}
