#include <iostream>
using namespace std;
long long N,A[100002],B[100001];
int main() {
	cin>>N;
	for(int i=1;i<=N+1;i++)cin>>A[i];
	for(int i=1;i<=N;i++)cin>>B[i];
	long long c=0;
	for(int i=1;i<=N;i++){
		if(B[i]<=A[i]){c+=B[i];A[i]-=B[i];B[i]=0;}
		else{c+=A[i];B[i]-=A[i];A[i]=0;
		   if(B[i]<=A[i+1]){c+=B[i];A[i+1]-=B[i];B[i]=0;}
		   else{c+=A[i+1];B[i]-=A[i+1];A[i+1]=0;}
		}
	}
	cout<<c;
	return 0;
}
