#include <stdio.h>
int main(){
  int n,b;
  long ans=0;
  scanf("%d",&n);
  int a[n+1];
  for(int i=0;i<n+1;i++){
    scanf("%d",&a[i]);
  }
  for(int i=0;i<n;i++){
   scanf("%d",&b);
    if(a[i]>b){
      ans=ans+b;
    }
    else{
      if(a[i+1]>b-a[i]){
        ans=ans+b;
        a[i+1]=a[i+1]+a[i]-b;
      }
      else{
        ans=ans+a[i]+a[i+1];
        a[i+1]=0;
      }
    }
  }
  printf("%ld",ans);
}