Scanf.scanf "%d" (fun n ->
    let a = Array.init 2 (fun _ -> Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a))) in
    let rec loop i ma =
        if i = n then ma else
            let rec loop2 j acc =
                if j >= n then acc else
                    let acc = if j <= i then acc + a.(0).(j) else acc in
                    let acc = if j >= i then acc + a.(1).(j) else acc in
                    loop2 (j + 1) acc
            in
            let acc = loop2 0 0 in
            loop (i + 1) (max ma acc)
    in
    loop 0 0 |> Printf.printf "%d\n"
)