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