#include <iostream>
#define int long long
using namespace std;

int32_t main()
{
  int n; cin>>n;
  int arr[n + 1];
  for(int i = 0; i < n + 1; i++) cin>>arr[i];
  int brr[n];
  for(int i = 0; i < n ; i++) cin>>brr[i];
  int ans = 0;
  for(int i = 0; i < n; i++)
  {
    int tm = min(brr[i],arr[i]);
    brr[i] -= tm;
    int a = min(brr[i],arr[i+1]);
    arr[i+1] -= a;
    ans += tm + a;
    
  }
  cout<<ans;
}
