#include <bits/stdc++.h> 
using namespace std;
#define rep(i,cc,n) for(int i=cc; i<n; i++)

int main() {
  int n;
  cin >> n;
  long A[n+1], B[n], ans=0.0;
  rep(i,0,n+1) cin >> A[i];
  rep(i,0,n) cin >> B[i];

  rep(i,0,n) {
  int left=min(A[i],B[i]);
  A[i] -= left;
  B[i] -= left;
  ans += left;

  int right=min(A[i+1], B[i]);
  B[i] -= right;
  A[i+1] -= right;
  ans += right;
  }

  cout << ans << endl;
}