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