import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] mon = new int[n + 1];
    int[] brave = new int[n];
    for(int i = 0 ; i < n + 1 ; i++){
      mon[i] = Integer.parseInt(sc.next());
    }
    long cnt = 0L;
    for(int i = 0 ; i < n ; i++){
      brave[i] = Integer.parseInt(sc.next());
      if(brave[i] > mon[i]){
        cnt += mon[i];
        brave[i] -= mon[i];

        if(brave[i] >= mon[i + 1]){
          cnt += mon[i + 1];
          mon[i + 1] = 0;
        }else{
          cnt += brave[i];
          mon[i + 1] -= brave[i];
        }

      }else{
        cnt += brave[i];
      }
    }
    System.out.println(cnt);
  }
}

 import java.util.Scanner; Scanner java.util class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] mon = new int[n + 1];
    int[] brave = new int[n];
    for(int i = 0 ; i < n + 1 ; i++){
      mon[i] = Integer.parseInt(sc.next());
    }
    long cnt = 0L;
    for(int i = 0 ; i < n ; i++){
      brave[i] = Integer.parseInt(sc.next());
      if(brave[i] > mon[i]){
        cnt += mon[i];
        brave[i] -= mon[i];

        if(brave[i] >= mon[i + 1]){
          cnt += mon[i + 1];
          mon[i + 1] = 0;
        }else{
          cnt += brave[i];
          mon[i + 1] -= brave[i];
        }

      }else{
        cnt += brave[i];
      }
    }
    System.out.println(cnt);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] mon = new int[n + 1];
    int[] brave = new int[n];
    for(int i = 0 ; i < n + 1 ; i++){
      mon[i] = Integer.parseInt(sc.next());
    }
    long cnt = 0L;
    for(int i = 0 ; i < n ; i++){
      brave[i] = Integer.parseInt(sc.next());
      if(brave[i] > mon[i]){
        cnt += mon[i];
        brave[i] -= mon[i];

        if(brave[i] >= mon[i + 1]){
          cnt += mon[i + 1];
          mon[i + 1] = 0;
        }else{
          cnt += brave[i];
          mon[i + 1] -= brave[i];
        }

      }else{
        cnt += brave[i];
      }
    }
    System.out.println(cnt);
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] mon = new int[n + 1];
    int[] brave = new int[n];
    for(int i = 0 ; i < n + 1 ; i++){
      mon[i] = Integer.parseInt(sc.next());
    }
    long cnt = 0L;
    for(int i = 0 ; i < n ; i++){
      brave[i] = Integer.parseInt(sc.next());
      if(brave[i] > mon[i]){
        cnt += mon[i];
        brave[i] -= mon[i];

        if(brave[i] >= mon[i + 1]){
          cnt += mon[i + 1];
          mon[i + 1] = 0;
        }else{
          cnt += brave[i];
          mon[i + 1] -= brave[i];
        }

      }else{
        cnt += brave[i];
      }
    }
    System.out.println(cnt);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] mon = new int[n + 1]; mon new int[n + 1] n + 1 n 1 int[] brave = new int[n]; brave new int[n] n for(int i = 0 ; i < n + 1 ; i++){
      mon[i] = Integer.parseInt(sc.next());
    } int i = 0 ; int i = 0 ; i 0 i < n + 1 i n + 1 n 1 i++ i++ i {
      mon[i] = Integer.parseInt(sc.next());
    } {
      mon[i] = Integer.parseInt(sc.next());
    } mon[i] = Integer.parseInt(sc.next()) mon[i] mon i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc long cnt = 0L; cnt 0L for(int i = 0 ; i < n ; i++){
      brave[i] = Integer.parseInt(sc.next());
      if(brave[i] > mon[i]){
        cnt += mon[i];
        brave[i] -= mon[i];

        if(brave[i] >= mon[i + 1]){
          cnt += mon[i + 1];
          mon[i + 1] = 0;
        }else{
          cnt += brave[i];
          mon[i + 1] -= brave[i];
        }

      }else{
        cnt += brave[i];
      }
    } int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
      brave[i] = Integer.parseInt(sc.next());
      if(brave[i] > mon[i]){
        cnt += mon[i];
        brave[i] -= mon[i];

        if(brave[i] >= mon[i + 1]){
          cnt += mon[i + 1];
          mon[i + 1] = 0;
        }else{
          cnt += brave[i];
          mon[i + 1] -= brave[i];
        }

      }else{
        cnt += brave[i];
      }
    } {
      brave[i] = Integer.parseInt(sc.next());
      if(brave[i] > mon[i]){
        cnt += mon[i];
        brave[i] -= mon[i];

        if(brave[i] >= mon[i + 1]){
          cnt += mon[i + 1];
          mon[i + 1] = 0;
        }else{
          cnt += brave[i];
          mon[i + 1] -= brave[i];
        }

      }else{
        cnt += brave[i];
      }
    } brave[i] = Integer.parseInt(sc.next()) brave[i] brave i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if(brave[i] > mon[i]){
        cnt += mon[i];
        brave[i] -= mon[i];

        if(brave[i] >= mon[i + 1]){
          cnt += mon[i + 1];
          mon[i + 1] = 0;
        }else{
          cnt += brave[i];
          mon[i + 1] -= brave[i];
        }

      }else{
        cnt += brave[i];
      } brave[i] > mon[i] brave[i] brave i mon[i] mon i {
        cnt += mon[i];
        brave[i] -= mon[i];

        if(brave[i] >= mon[i + 1]){
          cnt += mon[i + 1];
          mon[i + 1] = 0;
        }else{
          cnt += brave[i];
          mon[i + 1] -= brave[i];
        }

      } cnt += mon[i] cnt mon[i] mon i brave[i] -= mon[i] brave[i] brave i mon[i] mon i if(brave[i] >= mon[i + 1]){
          cnt += mon[i + 1];
          mon[i + 1] = 0;
        }else{
          cnt += brave[i];
          mon[i + 1] -= brave[i];
        } brave[i] >= mon[i + 1] brave[i] brave i mon[i + 1] mon i + 1 i 1 {
          cnt += mon[i + 1];
          mon[i + 1] = 0;
        } cnt += mon[i + 1] cnt mon[i + 1] mon i + 1 i 1 mon[i + 1] = 0 mon[i + 1] mon i + 1 i 1 0 {
          cnt += brave[i];
          mon[i + 1] -= brave[i];
        } cnt += brave[i] cnt brave[i] brave i mon[i + 1] -= brave[i] mon[i + 1] mon i + 1 i 1 brave[i] brave i {
        cnt += brave[i];
      } cnt += brave[i] cnt brave[i] brave i System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] mon = new int[n + 1];
    int[] brave = new int[n];
    for(int i = 0 ; i < n + 1 ; i++){
      mon[i] = Integer.parseInt(sc.next());
    }
    long cnt = 0L;
    for(int i = 0 ; i < n ; i++){
      brave[i] = Integer.parseInt(sc.next());
      if(brave[i] > mon[i]){
        cnt += mon[i];
        brave[i] -= mon[i];

        if(brave[i] >= mon[i + 1]){
          cnt += mon[i + 1];
          mon[i + 1] = 0;
        }else{
          cnt += brave[i];
          mon[i + 1] -= brave[i];
        }

      }else{
        cnt += brave[i];
      }
    }
    System.out.println(cnt);
  }
}


