let map2 f a b =
  let l = Array.length a in
  let r = Array.make l (f a.(0) b.(0)) in
  for i = 1 to l - 1 do
    r.(i) <- f a.(i) b.(i)
  done;
  r

let () = Scanf.scanf "%d\n" @@ fun n ->
    let v = Array.init n (fun _ -> Scanf.scanf "%d " (fun v -> v)) in
    let c = Array.init n (fun _ -> Scanf.scanf "%d " (fun v -> v)) in
    let xy = map2 (fun v c -> v - c) v c in
    Array.sort (fun x y -> y - x) xy;
    let a = xy.(0) in
    Printf.printf "%d" @@ if Array.length xy > 1 then
        max a @@ max (xy.(0) + xy.(1)) 0
    else
        max a 0
