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