open Printf open Scanf
open Array

let () =
  scanf " %d" @@ fun n ->
    let vs = init n (fun _ -> scanf " %d" @@ fun v -> v) in
    let cs = init n (fun _ -> scanf " %d" @@ fun v -> v)
    in
    let rec lp a i =
      if i=n then (
        a
      ) else (
        max
          (lp a (i+1))
          (lp (a + vs.(i) - cs.(i)) (i+1)))
    in
    print_int @@ lp 0 0

