Scanf.scanf "%d %d %d" (fun n z w ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in
    let a1 = abs (w - a.(n - 1)) in
    let a2 = if n = 1 then a1 else abs (a.(n - 1) - a.(n - 2)) in
    Printf.printf "%d\n" @@ max a1 a2
)