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

int main() {
  int N;
  cin >> N;
  vector<int> A(N+1), B(N);
  rep(i, N+1) cin >> A[i];
  rep(i, N) cin >> B[i];

  ll ans = 0;

  rep(i, N) {
    int l = min(A[i], B[i]);
    int r = min(A[i+1], B[i] - l);
    A[i+1] -= r;
    ans += l + r;
  }

  cout << ans << endl;
}
