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

int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, a[100100], b;
  cin >> n;
  for (int i = 0; i <= n; i++)
    cin >> a[i];

  long long ans = 0;
  for (int i = 0; i < n; i++)
  {
    cin >> b;
    int kill = min(a[i], b);
    b -= kill;
    ans += kill;
    kill = min(a[i + 1], b);
    a[i + 1] -= kill;
    ans += kill;
  }
  cout << ans << endl;
}
