#include <bits/stdc++.h>
using namespace std;

int main() {
	
	long long int n,sum=0; cin>>n;
	int a[n+1],b[n];
	for(int i=0;i<n+1;i++) cin>>a[i];
	for(int i=0;i<n;i++) {
		cin>>b[i];
	}
	for(int i=0;i<n;i++) {
		if(a[i]>=b[i]) { sum+=b[i]; }
		else {
			b[i]-=a[i];
			sum+=a[i];
			if(a[i+1]>=b[i])  { 
				a[i+1]-=b[i]; sum+=b[i];
			}
			else {
				sum+=a[i+1]; a[i+1]=0;
			}	
		}
	}
	cout<<sum<<endl;
}