(* 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 ss = Array.init a @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let ts = Array.init b @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let ns = [|a; b|]
let sts = [|ss; ts|]
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
  if yi1 = 0 then ps.(yi1) - x
  else if yi1 = ns.(i) then x - ps.(yi1 - 1)
  else min (x - ps.(yi1 - 1)) @@ ps.(yi1) - x
let f x =
  let si1, ti1 = binary_search x ss, binary_search x ts in
  let s0, s1, t0, t1 =
    (if si1 = 0 then -kInf else ss.(si1 - 1)), (if si1 = a then kInf else ss.(si1)),
    (if ti1 = 0 then -kInf else ts.(ti1 - 1)), (if ti1 = b then kInf else ts.(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