#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main() {
  ll n, o = 0;
  cin >> n;
  vector<int> a(n + 1), b(n);
  for(int i = 0; i < n + 1; i++)
    cin >> a.at(i);
  for(int i = 0; i < n; i++)
    cin >> b.at(i);
  for(int i = n - 1; i >= 0; i--) {
    o += min(b.at(i), a.at(i) + a.at(i + 1));
    a.at(i) = min(a.at(i), max(0, a.at(i) + a.at(i + 1) - b.at(i)));
  }
  cout << o << endl;
}