import java.util.*;
 
public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    String[] s1 = sc.nextLine().split(" ");
    String[] s2 = sc.nextLine().split(" ");
    int[][] candies = new int[N][2];
    
    for(int i  = 0; i < N; i++){
      candies[i][0] = Integer.parseInt(s1[i]);
      candies[i][1] = Integer.parseInt(s2[i]);
    }
    
    int[][] dp = new int[N][2];
    dp[0][0] = candies[0][0];
    dp[0][1] = dp[0][0] + candies[0][1];
    
    
    for(int i = 1; i < N; i++){
      dp[i][0] = dp[i-1][0] + candies[i][0];
      if(candies[i][1]+dp[i-1][1] > candies[i][1]+dp[i][0]){
        dp[i][1] = candies[i][1]+dp[i-1][1];
      }else{
        dp[i][1] = candies[i][1]+dp[i][0];
      }
    }
    
    System.out.println(dp[N-1][1]);
  }
} 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.nextLine());
    String[] s1 = sc.nextLine().split(" ");
    String[] s2 = sc.nextLine().split(" ");
    int[][] candies = new int[N][2];
    
    for(int i  = 0; i < N; i++){
      candies[i][0] = Integer.parseInt(s1[i]);
      candies[i][1] = Integer.parseInt(s2[i]);
    }
    
    int[][] dp = new int[N][2];
    dp[0][0] = candies[0][0];
    dp[0][1] = dp[0][0] + candies[0][1];
    
    
    for(int i = 1; i < N; i++){
      dp[i][0] = dp[i-1][0] + candies[i][0];
      if(candies[i][1]+dp[i-1][1] > candies[i][1]+dp[i][0]){
        dp[i][1] = candies[i][1]+dp[i-1][1];
      }else{
        dp[i][1] = candies[i][1]+dp[i][0];
      }
    }
    
    System.out.println(dp[N-1][1]);
  }
} Main public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    String[] s1 = sc.nextLine().split(" ");
    String[] s2 = sc.nextLine().split(" ");
    int[][] candies = new int[N][2];
    
    for(int i  = 0; i < N; i++){
      candies[i][0] = Integer.parseInt(s1[i]);
      candies[i][1] = Integer.parseInt(s2[i]);
    }
    
    int[][] dp = new int[N][2];
    dp[0][0] = candies[0][0];
    dp[0][1] = dp[0][0] + candies[0][1];
    
    
    for(int i = 1; i < N; i++){
      dp[i][0] = dp[i-1][0] + candies[i][0];
      if(candies[i][1]+dp[i-1][1] > candies[i][1]+dp[i][0]){
        dp[i][1] = candies[i][1]+dp[i-1][1];
      }else{
        dp[i][1] = candies[i][1]+dp[i][0];
      }
    }
    
    System.out.println(dp[N-1][1]);
  } main {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    String[] s1 = sc.nextLine().split(" ");
    String[] s2 = sc.nextLine().split(" ");
    int[][] candies = new int[N][2];
    
    for(int i  = 0; i < N; i++){
      candies[i][0] = Integer.parseInt(s1[i]);
      candies[i][1] = Integer.parseInt(s2[i]);
    }
    
    int[][] dp = new int[N][2];
    dp[0][0] = candies[0][0];
    dp[0][1] = dp[0][0] + candies[0][1];
    
    
    for(int i = 1; i < N; i++){
      dp[i][0] = dp[i-1][0] + candies[i][0];
      if(candies[i][1]+dp[i-1][1] > candies[i][1]+dp[i][0]){
        dp[i][1] = candies[i][1]+dp[i-1][1];
      }else{
        dp[i][1] = candies[i][1]+dp[i][0];
      }
    }
    
    System.out.println(dp[N-1][1]);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.nextLine()); N Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc String[] s1 = sc.nextLine().split(" "); s1 sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " String[] s2 = sc.nextLine().split(" "); s2 sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int[][] candies = new int[N][2]; candies new int[N][2] N 2 for(int i  = 0; i < N; i++){
      candies[i][0] = Integer.parseInt(s1[i]);
      candies[i][1] = Integer.parseInt(s2[i]);
    } int i  = 0; int i  = 0; i 0 i < N i N i++ i++ i {
      candies[i][0] = Integer.parseInt(s1[i]);
      candies[i][1] = Integer.parseInt(s2[i]);
    } {
      candies[i][0] = Integer.parseInt(s1[i]);
      candies[i][1] = Integer.parseInt(s2[i]);
    } candies[i][0] = Integer.parseInt(s1[i]) candies[i][0] candies[i] candies i 0 Integer.parseInt(s1[i]) Integer.parseInt Integer s1[i] s1 i candies[i][1] = Integer.parseInt(s2[i]) candies[i][1] candies[i] candies i 1 Integer.parseInt(s2[i]) Integer.parseInt Integer s2[i] s2 i int[][] dp = new int[N][2]; dp new int[N][2] N 2 dp[0][0] = candies[0][0] dp[0][0] dp[0] dp 0 0 candies[0][0] candies[0] candies 0 0 dp[0][1] = dp[0][0] + candies[0][1] dp[0][1] dp[0] dp 0 1 dp[0][0] + candies[0][1] dp[0][0] dp[0] dp 0 0 candies[0][1] candies[0] candies 0 1 for(int i = 1; i < N; i++){
      dp[i][0] = dp[i-1][0] + candies[i][0];
      if(candies[i][1]+dp[i-1][1] > candies[i][1]+dp[i][0]){
        dp[i][1] = candies[i][1]+dp[i-1][1];
      }else{
        dp[i][1] = candies[i][1]+dp[i][0];
      }
    } int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
      dp[i][0] = dp[i-1][0] + candies[i][0];
      if(candies[i][1]+dp[i-1][1] > candies[i][1]+dp[i][0]){
        dp[i][1] = candies[i][1]+dp[i-1][1];
      }else{
        dp[i][1] = candies[i][1]+dp[i][0];
      }
    } {
      dp[i][0] = dp[i-1][0] + candies[i][0];
      if(candies[i][1]+dp[i-1][1] > candies[i][1]+dp[i][0]){
        dp[i][1] = candies[i][1]+dp[i-1][1];
      }else{
        dp[i][1] = candies[i][1]+dp[i][0];
      }
    } dp[i][0] = dp[i-1][0] + candies[i][0] dp[i][0] dp[i] dp i 0 dp[i-1][0] + candies[i][0] dp[i-1][0] dp[i-1] dp i-1 i 1 0 candies[i][0] candies[i] candies i 0 if(candies[i][1]+dp[i-1][1] > candies[i][1]+dp[i][0]){
        dp[i][1] = candies[i][1]+dp[i-1][1];
      }else{
        dp[i][1] = candies[i][1]+dp[i][0];
      } candies[i][1]+dp[i-1][1] > candies[i][1]+dp[i][0] candies[i][1]+dp[i-1][1] candies[i][1] candies[i] candies i 1 dp[i-1][1] dp[i-1] dp i-1 i 1 1 candies[i][1]+dp[i][0] candies[i][1] candies[i] candies i 1 dp[i][0] dp[i] dp i 0 {
        dp[i][1] = candies[i][1]+dp[i-1][1];
      } dp[i][1] = candies[i][1]+dp[i-1][1] dp[i][1] dp[i] dp i 1 candies[i][1]+dp[i-1][1] candies[i][1] candies[i] candies i 1 dp[i-1][1] dp[i-1] dp i-1 i 1 1 {
        dp[i][1] = candies[i][1]+dp[i][0];
      } dp[i][1] = candies[i][1]+dp[i][0] dp[i][1] dp[i] dp i 1 candies[i][1]+dp[i][0] candies[i][1] candies[i] candies i 1 dp[i][0] dp[i] dp i 0 System.out.println(dp[N-1][1]) System.out.println System.out System System.out dp[N-1][1] dp[N-1] dp N-1 N 1 1 String[]args args public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    String[] s1 = sc.nextLine().split(" ");
    String[] s2 = sc.nextLine().split(" ");
    int[][] candies = new int[N][2];
    
    for(int i  = 0; i < N; i++){
      candies[i][0] = Integer.parseInt(s1[i]);
      candies[i][1] = Integer.parseInt(s2[i]);
    }
    
    int[][] dp = new int[N][2];
    dp[0][0] = candies[0][0];
    dp[0][1] = dp[0][0] + candies[0][1];
    
    
    for(int i = 1; i < N; i++){
      dp[i][0] = dp[i-1][0] + candies[i][0];
      if(candies[i][1]+dp[i-1][1] > candies[i][1]+dp[i][0]){
        dp[i][1] = candies[i][1]+dp[i-1][1];
      }else{
        dp[i][1] = candies[i][1]+dp[i][0];
      }
    }
    
    System.out.println(dp[N-1][1]);
  }
} public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    String[] s1 = sc.nextLine().split(" ");
    String[] s2 = sc.nextLine().split(" ");
    int[][] candies = new int[N][2];
    
    for(int i  = 0; i < N; i++){
      candies[i][0] = Integer.parseInt(s1[i]);
      candies[i][1] = Integer.parseInt(s2[i]);
    }
    
    int[][] dp = new int[N][2];
    dp[0][0] = candies[0][0];
    dp[0][1] = dp[0][0] + candies[0][1];
    
    
    for(int i = 1; i < N; i++){
      dp[i][0] = dp[i-1][0] + candies[i][0];
      if(candies[i][1]+dp[i-1][1] > candies[i][1]+dp[i][0]){
        dp[i][1] = candies[i][1]+dp[i-1][1];
      }else{
        dp[i][1] = candies[i][1]+dp[i][0];
      }
    }
    
    System.out.println(dp[N-1][1]);
  }
} Main
import java.util.*;
 
public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    String[] s1 = sc.nextLine().split(" ");
    String[] s2 = sc.nextLine().split(" ");
    int[][] candies = new int[N][2];
    
    for(int i  = 0; i < N; i++){
      candies[i][0] = Integer.parseInt(s1[i]);
      candies[i][1] = Integer.parseInt(s2[i]);
    }
    
    int[][] dp = new int[N][2];
    dp[0][0] = candies[0][0];
    dp[0][1] = dp[0][0] + candies[0][1];
    
    
    for(int i = 1; i < N; i++){
      dp[i][0] = dp[i-1][0] + candies[i][0];
      if(candies[i][1]+dp[i-1][1] > candies[i][1]+dp[i][0]){
        dp[i][1] = candies[i][1]+dp[i-1][1];
      }else{
        dp[i][1] = candies[i][1]+dp[i][0];
      }
    }
    
    System.out.println(dp[N-1][1]);
  }
}