#include <bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin >> n;

  vector<long long> a(n+1);

  for (int i = 0; i < n+1; i++)
  {
    cin >> a[i];
  }

  long long ans=0;
  for (int i = 0; i < n; i++)
  {
    long long b;
    cin >> b;

    long long tmp=min(a[i],b);
    ans+=tmp;
    b-=tmp;

    tmp=min(a[i+1],b);
    ans+=tmp;
    a[i+1]-=tmp;    
  }

  cout << ans << endl;
}