#include <bits/stdc++.h>

using namespace std;
int main(){
  long n;
   cin >> n;
  
  vector<long> a(n+1),b(n+1);
  for(long i=0;i<=n;i++) cin >> a[i];
  for(long i=0;i<n;i++) cin >> b[i];
  
  b[n]=0;
  
  
  long res=0,num=0;
  for(long i=0;i<=n;i++){
   res+=min(b[i]+num,a[i]);
  num=max(long(0),b[i]-max(long(0),a[i]-num));
 
  }
  
  cout << res << endl;
}