#include<iostream>
#include<vector>
#include<algorithm>


using namespace std;


int main(){
  long long N,b;
  cin >> N;
  vector<long long > city(N+1);


  for(long long i =0; i <N+1; ++i){
    cin >> city[i];
  }

  long  ans =0;
  for(long long i =0; i <N; ++i){
    cin >> b;
    long t = min(b,city[i] + city[i+1]);
    ans += t;
    city[i+1] -= t - min(b,city[i]);
  }  
  cout << ans << endl;
}
