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