let (>>=) xs f = List.map f xs |> List.concat
let lower_bound p arr =
  let len = Array.length arr in
  let rec f l r =
    if l+1 >= r then r
    else
      let m = (l+r) / 2 in
      if p arr.(m) then f l m else f m r
  in f (-1) len
let lower_bound' p arr =
  let idx = lower_bound p arr in
  if idx >= Array.length arr then [] else [arr.(idx)]
let sign = compare 0
let () =
  Scanf.scanf "%d %d %d" @@ fun a b q ->
  let s = Array.init a (fun _ -> Scanf.scanf " %d" ((+) 0)) in
  let t = Array.init b (fun _ -> Scanf.scanf " %d" ((+) 0)) in
  let s' = Array.init a (fun i -> s.(a-1-i)) in
  let t' = Array.init b (fun i -> t.(b-1-i)) in
  let xs = Array.init q (fun _ -> Scanf.scanf " %d" ((+) 0)) in
  xs |> Array.iter @@ fun x ->
    ((lower_bound' ((<=) x) s @ lower_bound' ((>=) x) s') >>= fun sh ->
     (lower_bound' ((<=) x) t @ lower_bound' ((>=) x) t') >>= fun tp ->
       let v, w = min (abs (sh-x)) (abs (tp-x)), max (abs (sh-x)) (abs (tp-x)) in
       if sign (sh-x) * sign (tp-x) >= 0 then [w] else [2*v + w])
    |> List.fold_left min 10101010101010 |> Printf.printf "%d\n"
