let (>>=) xs f = List.map f xs |> List.concat
let lower_bound p arr =
  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) (Array.length arr)
let sign = compare 0
let inf = 10101010101010
let sentinel arr = Array.concat [[|-inf|]; arr; [|inf|]]
let () =
  Scanf.scanf "%d %d %d" @@ fun a b q ->
  let s = sentinel (Array.init a (fun _ -> Scanf.scanf " %d" ((+) 0))) in
  let t = sentinel (Array.init b (fun _ -> Scanf.scanf " %d" ((+) 0))) in
  Array.init q (fun _ -> Scanf.scanf " %d" ((+) 0))
  |> Array.iter @@ fun x ->
    let sh = lower_bound ((<=) x) s in
    let tp = lower_bound ((<=) x) t in
    ([s.(sh-1); s.(sh)] >>= fun sh ->
     [t.(tp-1); t.(tp)] >>= 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 inf|> Printf.printf "%d\n"