open Batteries
open Printf
open Scanf

let (++) = Int64.add
let (--) = Int64.sub
let ( ** ) = Int64.mul
let (//) = Int64.div
let (%%) = Int64.rem

let read_int _ = scanf " %d " (fun x -> x)
let read_long _ = scanf " %Ld " (fun x -> x)

let inf = 0x003f3f3f3f3f3f3fL

let dist x s =
  match Array.bsearch Int64.ord s x with
  | `At i -> (0L,0L)
  | `All_lower -> (x -- s.(Array.length s - 1), inf)
  | `All_bigger -> (inf, s.(0) -- x)
  | `Just_after i -> (x -- s.(i), (s.(i+1) -- x))
  | `Empty -> (inf,inf)

let () =
  let a,b,q = scanf " %d %d %d " (fun x y z -> (x,y,z)) in
  let s = Array.init a read_long in
  let t = Array.init b read_long in
  let x = Array.init q read_long in
  Array.iter (fun x ->
      let (ls,rs) = dist x s in
      let (lt,rt) = dist x t in
      let ans = List.min [
          max ls lt; 2L**(ls++rt)--(max ls rt); max rs rt; 2L**(rs++lt)--(max rs lt)
        ] in
      printf "%Ld\n" ans
    ) x
