import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static int[][] grid;
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		grid = new int[2][n];
		for(int i =0; i <2; i++){
			for(int j =0; j < n; j++){
				grid[i][j] = sc.nextInt();
			}
		}
		memoGrid = new int[2][n];
		Arrays.fill(memoGrid[0], 0);
		Arrays.fill(memoGrid[1], 0);
		move(0,0,0);
		System.out.println(memoGrid[1][n-1]);

	}
	private static int[][] memoGrid;

	private static void move(int i, int j, int score){
		int length = memoGrid[0].length;
		score += grid[i][j];
		if(score < memoGrid[i][j]) return;
		memoGrid[i][j] = score;
		boolean canDown = i == 0;
		boolean canRight = j < length-1;
		if(canDown){
			if(canRight) move(i+1,j+1,score);
			move(i+1,j,score);
		}
		if(canRight) move(i, j+1, score);
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	static int[][] grid;
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		grid = new int[2][n];
		for(int i =0; i <2; i++){
			for(int j =0; j < n; j++){
				grid[i][j] = sc.nextInt();
			}
		}
		memoGrid = new int[2][n];
		Arrays.fill(memoGrid[0], 0);
		Arrays.fill(memoGrid[1], 0);
		move(0,0,0);
		System.out.println(memoGrid[1][n-1]);

	}
	private static int[][] memoGrid;

	private static void move(int i, int j, int score){
		int length = memoGrid[0].length;
		score += grid[i][j];
		if(score < memoGrid[i][j]) return;
		memoGrid[i][j] = score;
		boolean canDown = i == 0;
		boolean canRight = j < length-1;
		if(canDown){
			if(canRight) move(i+1,j+1,score);
			move(i+1,j,score);
		}
		if(canRight) move(i, j+1, score);
	}
} Main static int[][] grid; grid private static int[][] memoGrid; memoGrid public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		grid = new int[2][n];
		for(int i =0; i <2; i++){
			for(int j =0; j < n; j++){
				grid[i][j] = sc.nextInt();
			}
		}
		memoGrid = new int[2][n];
		Arrays.fill(memoGrid[0], 0);
		Arrays.fill(memoGrid[1], 0);
		move(0,0,0);
		System.out.println(memoGrid[1][n-1]);

	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		grid = new int[2][n];
		for(int i =0; i <2; i++){
			for(int j =0; j < n; j++){
				grid[i][j] = sc.nextInt();
			}
		}
		memoGrid = new int[2][n];
		Arrays.fill(memoGrid[0], 0);
		Arrays.fill(memoGrid[1], 0);
		move(0,0,0);
		System.out.println(memoGrid[1][n-1]);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc grid = new int[2][n] grid new int[2][n] 2 n for(int i =0; i <2; i++){
			for(int j =0; j < n; j++){
				grid[i][j] = sc.nextInt();
			}
		} int i =0; int i =0; i 0 i <2 i 2 i++ i++ i {
			for(int j =0; j < n; j++){
				grid[i][j] = sc.nextInt();
			}
		} {
			for(int j =0; j < n; j++){
				grid[i][j] = sc.nextInt();
			}
		} for(int j =0; j < n; j++){
				grid[i][j] = sc.nextInt();
			} int j =0; int j =0; j 0 j < n j n j++ j++ j {
				grid[i][j] = sc.nextInt();
			} {
				grid[i][j] = sc.nextInt();
			} grid[i][j] = sc.nextInt() grid[i][j] grid[i] grid i j sc.nextInt() sc.nextInt sc memoGrid = new int[2][n] memoGrid new int[2][n] 2 n Arrays.fill(memoGrid[0], 0) Arrays.fill Arrays memoGrid[0] memoGrid 0 0 Arrays.fill(memoGrid[1], 0) Arrays.fill Arrays memoGrid[1] memoGrid 1 0 move(0,0,0) move 0 0 0 System.out.println(memoGrid[1][n-1]) System.out.println System.out System System.out memoGrid[1][n-1] memoGrid[1] memoGrid 1 n-1 n 1 String[] args args private static void move(int i, int j, int score){
		int length = memoGrid[0].length;
		score += grid[i][j];
		if(score < memoGrid[i][j]) return;
		memoGrid[i][j] = score;
		boolean canDown = i == 0;
		boolean canRight = j < length-1;
		if(canDown){
			if(canRight) move(i+1,j+1,score);
			move(i+1,j,score);
		}
		if(canRight) move(i, j+1, score);
	} move {
		int length = memoGrid[0].length;
		score += grid[i][j];
		if(score < memoGrid[i][j]) return;
		memoGrid[i][j] = score;
		boolean canDown = i == 0;
		boolean canRight = j < length-1;
		if(canDown){
			if(canRight) move(i+1,j+1,score);
			move(i+1,j,score);
		}
		if(canRight) move(i, j+1, score);
	} int length = memoGrid[0].length; length memoGrid[0].length memoGrid[0] memoGrid 0 memoGrid[0].length score += grid[i][j] score grid[i][j] grid[i] grid i j if(score < memoGrid[i][j]) return; score < memoGrid[i][j] score memoGrid[i][j] memoGrid[i] memoGrid i j return; memoGrid[i][j] = score memoGrid[i][j] memoGrid[i] memoGrid i j score boolean canDown = i == 0; canDown i == 0 i 0 boolean canRight = j < length-1; canRight j < length-1 j length-1 length 1 if(canDown){
			if(canRight) move(i+1,j+1,score);
			move(i+1,j,score);
		} canDown {
			if(canRight) move(i+1,j+1,score);
			move(i+1,j,score);
		} if(canRight) move(i+1,j+1,score); canRight move(i+1,j+1,score) move i+1 i 1 j+1 j 1 score move(i+1,j,score) move i+1 i 1 j score if(canRight) move(i, j+1, score); canRight move(i, j+1, score) move i j+1 j 1 score int i i int j j int score score public class Main {
	static int[][] grid;
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		grid = new int[2][n];
		for(int i =0; i <2; i++){
			for(int j =0; j < n; j++){
				grid[i][j] = sc.nextInt();
			}
		}
		memoGrid = new int[2][n];
		Arrays.fill(memoGrid[0], 0);
		Arrays.fill(memoGrid[1], 0);
		move(0,0,0);
		System.out.println(memoGrid[1][n-1]);

	}
	private static int[][] memoGrid;

	private static void move(int i, int j, int score){
		int length = memoGrid[0].length;
		score += grid[i][j];
		if(score < memoGrid[i][j]) return;
		memoGrid[i][j] = score;
		boolean canDown = i == 0;
		boolean canRight = j < length-1;
		if(canDown){
			if(canRight) move(i+1,j+1,score);
			move(i+1,j,score);
		}
		if(canRight) move(i, j+1, score);
	}
} public class Main {
	static int[][] grid;
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		grid = new int[2][n];
		for(int i =0; i <2; i++){
			for(int j =0; j < n; j++){
				grid[i][j] = sc.nextInt();
			}
		}
		memoGrid = new int[2][n];
		Arrays.fill(memoGrid[0], 0);
		Arrays.fill(memoGrid[1], 0);
		move(0,0,0);
		System.out.println(memoGrid[1][n-1]);

	}
	private static int[][] memoGrid;

	private static void move(int i, int j, int score){
		int length = memoGrid[0].length;
		score += grid[i][j];
		if(score < memoGrid[i][j]) return;
		memoGrid[i][j] = score;
		boolean canDown = i == 0;
		boolean canRight = j < length-1;
		if(canDown){
			if(canRight) move(i+1,j+1,score);
			move(i+1,j,score);
		}
		if(canRight) move(i, j+1, score);
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static int[][] grid;
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		grid = new int[2][n];
		for(int i =0; i <2; i++){
			for(int j =0; j < n; j++){
				grid[i][j] = sc.nextInt();
			}
		}
		memoGrid = new int[2][n];
		Arrays.fill(memoGrid[0], 0);
		Arrays.fill(memoGrid[1], 0);
		move(0,0,0);
		System.out.println(memoGrid[1][n-1]);

	}
	private static int[][] memoGrid;

	private static void move(int i, int j, int score){
		int length = memoGrid[0].length;
		score += grid[i][j];
		if(score < memoGrid[i][j]) return;
		memoGrid[i][j] = score;
		boolean canDown = i == 0;
		boolean canRight = j < length-1;
		if(canDown){
			if(canRight) move(i+1,j+1,score);
			move(i+1,j,score);
		}
		if(canRight) move(i, j+1, score);
	}
}