(* q log(max a b) *)
let kInf = 20202020202
let a, b, q = Scanf.scanf " %d %d %d" @@ fun a b c -> a, b, c
let ns = [|a; b|]
let sts = Array.init 2 @@ fun i ->
  let ds = Array.make (ns.(i) + 2) 0 in
  ds.(0) <- -kInf; ds.(ns.(i) + 1) <- kInf;
  for j = 1 to ns.(i) do ds.(j) <- Scanf.scanf " %d" @@ (+) 0 done;
  ds
let xs = Array.init q @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let is_ok i key a = a.(i) >= key
let binary_search key a =
  let left, right = ref @@ -1, ref @@ Array.length a in
  while !right - !left > 1 do
    let mid = !left + (!right - !left) / 2 in
    if is_ok mid key a then right := mid
    else left := mid done;
  !right
let g x i =
  let ps = sts.(i) in
  let yi1 = binary_search x ps in
  min (x - ps.(yi1 - 1)) @@ ps.(yi1) - x
let f x =
  let si1, ti1 = binary_search x sts.(0), binary_search x sts.(1) in
  let s0, s1, t0, t1 = sts.(0).(si1 - 1), sts.(0).(si1), sts.(1).(ti1 - 1), sts.(1).(ti1) in
  let ans = ref kInf in
  ans := min !ans @@ if s0 < t0 then x - t0 + g t0 0 else x - s0 + g s0 1;
  ans := min !ans @@ if s1 < t1 then s1 - x + g s1 1 else t1 - x + g t1 0;
  Printf.printf "%d\n" !ans
let _ = Array.iter f xs