#include<iostream>
#include<algorithm>
using namespace std;

int main(){
  int N;cin>>N;
  long long int A[N+10];for(int i=0;i<=N;i++)cin>>A[i];
  long long int B[N+10];for(int i=0;i<N;i++)cin>>B[i];
  long long int res=0;
  for(int i=0;i<N;i++){
    int h=min(A[i],B[i]);
    res+=h,A[i]-=h,B[i]-=h;
    int e=min(A[i+1],B[i]);
    res+=e,A[i+1]-=e,B[i]-=e;
  }
  cout<<res<<endl;
}