#include<iostream>
#include<cstdio>
using namespace std;
const int N=1e5+9;
typedef long long ll;
int a[N];
ll ans,n;
int main(){
  cin>>n;
  for(int i=1;i<=n+1;i++)cin>>a[i];
  for(int i=1,t;i<=n;i++){
    cin>>t;
    if(t<=a[i]){ans+=t;continue;}
    ans+=a[i];t-=a[i];
    if(t<=a[i+1]){ans+=t,a[i+1]-=t;continue;}
    ans+=a[i+1],a[i+1]=0;
  }
  cout<<ans<<endl;
  return 0;
}