import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    long[] monster = new long[n+1];
    long[] hero = new long[n];
    long sum = 0;
    for(int i = 0; i <= n; i++) {
      monster[i] = Long.parseLong(sc.next());
    }
    for(int i = 0; i < n; i++) {
      hero[i] = Long.parseLong(sc.next());
    }
    if(monster[0] >= hero[0]) {
      sum += hero[0];
      hero[0] = 0;
    } else {
      sum += monster[0];
      hero[0] -= monster[0];
    }
    for(int i = 1; i < n; i++) {
      if(monster[i] > hero[i-1] + hero[i]) {
        sum += hero[i-1] + hero[i];
        hero[i] = 0;
      } else if(monster[i] <= hero[i-1]) {
        sum += monster[i];
      } else {
        sum += monster[i];
        hero[i] -= monster[i] - hero[i-1];
      }
    }
    if(monster[n] > hero[n-1]) sum += hero[n-1];
    else sum += monster[n];
    System.out.println(sum);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    long[] monster = new long[n+1];
    long[] hero = new long[n];
    long sum = 0;
    for(int i = 0; i <= n; i++) {
      monster[i] = Long.parseLong(sc.next());
    }
    for(int i = 0; i < n; i++) {
      hero[i] = Long.parseLong(sc.next());
    }
    if(monster[0] >= hero[0]) {
      sum += hero[0];
      hero[0] = 0;
    } else {
      sum += monster[0];
      hero[0] -= monster[0];
    }
    for(int i = 1; i < n; i++) {
      if(monster[i] > hero[i-1] + hero[i]) {
        sum += hero[i-1] + hero[i];
        hero[i] = 0;
      } else if(monster[i] <= hero[i-1]) {
        sum += monster[i];
      } else {
        sum += monster[i];
        hero[i] -= monster[i] - hero[i-1];
      }
    }
    if(monster[n] > hero[n-1]) sum += hero[n-1];
    else sum += monster[n];
    System.out.println(sum);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    long[] monster = new long[n+1];
    long[] hero = new long[n];
    long sum = 0;
    for(int i = 0; i <= n; i++) {
      monster[i] = Long.parseLong(sc.next());
    }
    for(int i = 0; i < n; i++) {
      hero[i] = Long.parseLong(sc.next());
    }
    if(monster[0] >= hero[0]) {
      sum += hero[0];
      hero[0] = 0;
    } else {
      sum += monster[0];
      hero[0] -= monster[0];
    }
    for(int i = 1; i < n; i++) {
      if(monster[i] > hero[i-1] + hero[i]) {
        sum += hero[i-1] + hero[i];
        hero[i] = 0;
      } else if(monster[i] <= hero[i-1]) {
        sum += monster[i];
      } else {
        sum += monster[i];
        hero[i] -= monster[i] - hero[i-1];
      }
    }
    if(monster[n] > hero[n-1]) sum += hero[n-1];
    else sum += monster[n];
    System.out.println(sum);
  } main {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    long[] monster = new long[n+1];
    long[] hero = new long[n];
    long sum = 0;
    for(int i = 0; i <= n; i++) {
      monster[i] = Long.parseLong(sc.next());
    }
    for(int i = 0; i < n; i++) {
      hero[i] = Long.parseLong(sc.next());
    }
    if(monster[0] >= hero[0]) {
      sum += hero[0];
      hero[0] = 0;
    } else {
      sum += monster[0];
      hero[0] -= monster[0];
    }
    for(int i = 1; i < n; i++) {
      if(monster[i] > hero[i-1] + hero[i]) {
        sum += hero[i-1] + hero[i];
        hero[i] = 0;
      } else if(monster[i] <= hero[i-1]) {
        sum += monster[i];
      } else {
        sum += monster[i];
        hero[i] -= monster[i] - hero[i-1];
      }
    }
    if(monster[n] > hero[n-1]) sum += hero[n-1];
    else sum += monster[n];
    System.out.println(sum);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc long[] monster = new long[n+1]; monster new long[n+1] n+1 n 1 long[] hero = new long[n]; hero new long[n] n long sum = 0; sum 0 for(int i = 0; i <= n; i++) {
      monster[i] = Long.parseLong(sc.next());
    } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
      monster[i] = Long.parseLong(sc.next());
    } {
      monster[i] = Long.parseLong(sc.next());
    } monster[i] = Long.parseLong(sc.next()) monster[i] monster i Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc for(int i = 0; i < n; i++) {
      hero[i] = Long.parseLong(sc.next());
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      hero[i] = Long.parseLong(sc.next());
    } {
      hero[i] = Long.parseLong(sc.next());
    } hero[i] = Long.parseLong(sc.next()) hero[i] hero i Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc if(monster[0] >= hero[0]) {
      sum += hero[0];
      hero[0] = 0;
    } else {
      sum += monster[0];
      hero[0] -= monster[0];
    } monster[0] >= hero[0] monster[0] monster 0 hero[0] hero 0 {
      sum += hero[0];
      hero[0] = 0;
    } sum += hero[0] sum hero[0] hero 0 hero[0] = 0 hero[0] hero 0 0 {
      sum += monster[0];
      hero[0] -= monster[0];
    } sum += monster[0] sum monster[0] monster 0 hero[0] -= monster[0] hero[0] hero 0 monster[0] monster 0 for(int i = 1; i < n; i++) {
      if(monster[i] > hero[i-1] + hero[i]) {
        sum += hero[i-1] + hero[i];
        hero[i] = 0;
      } else if(monster[i] <= hero[i-1]) {
        sum += monster[i];
      } else {
        sum += monster[i];
        hero[i] -= monster[i] - hero[i-1];
      }
    } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
      if(monster[i] > hero[i-1] + hero[i]) {
        sum += hero[i-1] + hero[i];
        hero[i] = 0;
      } else if(monster[i] <= hero[i-1]) {
        sum += monster[i];
      } else {
        sum += monster[i];
        hero[i] -= monster[i] - hero[i-1];
      }
    } {
      if(monster[i] > hero[i-1] + hero[i]) {
        sum += hero[i-1] + hero[i];
        hero[i] = 0;
      } else if(monster[i] <= hero[i-1]) {
        sum += monster[i];
      } else {
        sum += monster[i];
        hero[i] -= monster[i] - hero[i-1];
      }
    } if(monster[i] > hero[i-1] + hero[i]) {
        sum += hero[i-1] + hero[i];
        hero[i] = 0;
      } else if(monster[i] <= hero[i-1]) {
        sum += monster[i];
      } else {
        sum += monster[i];
        hero[i] -= monster[i] - hero[i-1];
      } monster[i] > hero[i-1] + hero[i] monster[i] monster i hero[i-1] + hero[i] hero[i-1] hero i-1 i 1 hero[i] hero i {
        sum += hero[i-1] + hero[i];
        hero[i] = 0;
      } sum += hero[i-1] + hero[i] sum hero[i-1] + hero[i] hero[i-1] hero i-1 i 1 hero[i] hero i hero[i] = 0 hero[i] hero i 0 if(monster[i] <= hero[i-1]) {
        sum += monster[i];
      } else {
        sum += monster[i];
        hero[i] -= monster[i] - hero[i-1];
      } monster[i] <= hero[i-1] monster[i] monster i hero[i-1] hero i-1 i 1 {
        sum += monster[i];
      } sum += monster[i] sum monster[i] monster i {
        sum += monster[i];
        hero[i] -= monster[i] - hero[i-1];
      } sum += monster[i] sum monster[i] monster i hero[i] -= monster[i] - hero[i-1] hero[i] hero i monster[i] - hero[i-1] monster[i] monster i hero[i-1] hero i-1 i 1 if(monster[n] > hero[n-1]) sum += hero[n-1];
    else sum += monster[n]; monster[n] > hero[n-1] monster[n] monster n hero[n-1] hero n-1 n 1 sum += hero[n-1] sum hero[n-1] hero n-1 n 1 sum += monster[n] sum monster[n] monster n System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    long[] monster = new long[n+1];
    long[] hero = new long[n];
    long sum = 0;
    for(int i = 0; i <= n; i++) {
      monster[i] = Long.parseLong(sc.next());
    }
    for(int i = 0; i < n; i++) {
      hero[i] = Long.parseLong(sc.next());
    }
    if(monster[0] >= hero[0]) {
      sum += hero[0];
      hero[0] = 0;
    } else {
      sum += monster[0];
      hero[0] -= monster[0];
    }
    for(int i = 1; i < n; i++) {
      if(monster[i] > hero[i-1] + hero[i]) {
        sum += hero[i-1] + hero[i];
        hero[i] = 0;
      } else if(monster[i] <= hero[i-1]) {
        sum += monster[i];
      } else {
        sum += monster[i];
        hero[i] -= monster[i] - hero[i-1];
      }
    }
    if(monster[n] > hero[n-1]) sum += hero[n-1];
    else sum += monster[n];
    System.out.println(sum);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    long[] monster = new long[n+1];
    long[] hero = new long[n];
    long sum = 0;
    for(int i = 0; i <= n; i++) {
      monster[i] = Long.parseLong(sc.next());
    }
    for(int i = 0; i < n; i++) {
      hero[i] = Long.parseLong(sc.next());
    }
    if(monster[0] >= hero[0]) {
      sum += hero[0];
      hero[0] = 0;
    } else {
      sum += monster[0];
      hero[0] -= monster[0];
    }
    for(int i = 1; i < n; i++) {
      if(monster[i] > hero[i-1] + hero[i]) {
        sum += hero[i-1] + hero[i];
        hero[i] = 0;
      } else if(monster[i] <= hero[i-1]) {
        sum += monster[i];
      } else {
        sum += monster[i];
        hero[i] -= monster[i] - hero[i-1];
      }
    }
    if(monster[n] > hero[n-1]) sum += hero[n-1];
    else sum += monster[n];
    System.out.println(sum);
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    long[] monster = new long[n+1];
    long[] hero = new long[n];
    long sum = 0;
    for(int i = 0; i <= n; i++) {
      monster[i] = Long.parseLong(sc.next());
    }
    for(int i = 0; i < n; i++) {
      hero[i] = Long.parseLong(sc.next());
    }
    if(monster[0] >= hero[0]) {
      sum += hero[0];
      hero[0] = 0;
    } else {
      sum += monster[0];
      hero[0] -= monster[0];
    }
    for(int i = 1; i < n; i++) {
      if(monster[i] > hero[i-1] + hero[i]) {
        sum += hero[i-1] + hero[i];
        hero[i] = 0;
      } else if(monster[i] <= hero[i-1]) {
        sum += monster[i];
      } else {
        sum += monster[i];
        hero[i] -= monster[i] - hero[i-1];
      }
    }
    if(monster[n] > hero[n-1]) sum += hero[n-1];
    else sum += monster[n];
    System.out.println(sum);
  }
}
