#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll a[100010],b[100010];
int main() {
	ll n;
	cin>>n;
	for(ll i=0;i<=n;i++){
		cin>>a[i];
	}
	ll ans=0;
	for(ll i=0;i<n;i++){
		cin>>b[i];
		ll now=min(a[i],b[i]);
		ans+=now;
		b[i]-=now;
		now=min(a[i+1],b[i]);
		ans+=now;
		a[i+1]-=now;
	}
	cout <<ans;
	// your code goes here
	return 0;
}