#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
	ll n,a[214514],b[214514];
int main() {
	cin>>n;
	for(int i=0;i<=n;i++)cin>>a[i];
	for(int i=0;i<n;i++)cin>>b[i];
	ll ans=0;
	for(int i=n-1;i>=0;i--){
		if(a[i+1]<=b[i]){
			b[i]-=a[i+1];
			ans+=a[i+1]+min(b[i],a[i]);
			a[i]-=min(b[i],a[i]);
		}else{
			ans+=b[i];
		}
	}
	cout<<ans<<endl;
	return 0;
}
