#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e5+5;
int n,x[N],y[N];
ll ans;
int main()
{
	cin>>n;
	for(int i=0;i<=n;i++)
	{
		cin>>x[i];
	}
	for(int i=0;i<n;i++)
	{
		cin>>y[i];
		ans+=min(y[i],x[i]+x[i+1]);
		x[i+1]-=min(max(0,y[i]-x[i]),x[i+1]);
	}
	cout<<ans<<endl;
	return 0;
}