(*
 * forall l r (p : forall n, l < n <= r -> bool),
 *   ( exists m,
 *     l < m <= r /\ forall n H, p n H = true <-> m <= n ) ->
 *   { m |
 *     l < m <= r /\ forall n H, p n H = true <-> m <= n }
 *)
let rec lower_bound l r p =
  if r <= 1 + l
  then r
  else let m = (l + r) / 2 in
       if p m
       then lower_bound l m p
       else lower_bound m r p

(*
 * forall l r (p : forall n, l <= n < r -> bool),
 *   ( exists m,
 *     l <= m < r /\ forall n H, p n H = true <-> n <= m ) ->
 *   { m |
 *     l <= m < r /\ forall n H, p n H = true <-> n <= m }
 *)
let rec upper_bound l r p =
  if r <= 1 + l
  then l
  else let m = (l + r) / 2 in
       if p m
       then upper_bound m r p
       else upper_bound l m p

let () = Scanf.scanf "%d %d %d\n" @@ fun a b q ->
  let ss = Array.make (a + 2) 0 in
  let ts = Array.make (b + 2) 0 in
  ss.(0) <- -123456789012345;
  ss.(a + 1) <- 123456789012345;
  for i = 1 to a do
    Scanf.scanf "%d\n" @@ Array.set ss i
  done;
  ts.(0) <- -123456789012345;
  ts.(b + 1) <- 123456789012345;
  for i = 1 to b do
    Scanf.scanf "%d\n" @@ Array.set ts i
  done;
  for i = 1 to q do
    Scanf.scanf "%d\n" @@ fun x ->
      let ls = upper_bound 0 (a + 2) @@ fun i -> ss.(i) <= x in
      let rs = lower_bound (-1) (a + 1) @@ fun i -> x <= ss.(i) in
      let lt = upper_bound 0 (b + 2) @@ fun i -> ts.(i) <= x in
      let rt = lower_bound (-1) (b + 1) @@ fun i -> x <= ts.(i) in
      Printf.printf "%d\n" @@ List.fold_left min max_int
      [ x - min ss.(ls) ts.(lt);
        max ss.(rs) ts.(rt) - x;
        2 * min ss.(rs) ts.(rt) - x - max ts.(lt) ss.(ls);
        x - 2 * max ts.(lt) ss.(ls) + min ss.(rs) ts.(rt) ]
  done