import Data.Array
import Control.Monad

find_near_idxs::Array Int Int -> Int -> (Int,Int)
find_near_idxs ar x = let (st,ed) = bounds ar in  rec ar x (st,ed)
                            where rec ar x (a,b) = if a+1 >= b
                                                      then (a,b)
                                                      else if ar!(div (a+b) 2) <= x
                                                              then (div (a+b) 2,b)
                                                              else (a,div (a+b) 2)

step::Array Int Int -> (Int,Int) -> [(Int,Int)]
step ar (x,cost) = let (i,j) = find_near_idxs ar x in [(ar!i,cost + (abs ((ar!i) - x))),(ar!j,cost + (abs ((ar!j) - x)))]

solver::Array Int Int -> Array Int Int -> Int -> Int
solver ar_1 ar_2 x = let pat_12 = (minimum.(map snd).concat.(map (step ar_2)).(step ar_1)) (x,0) in
                     let pat_21 = (minimum.(map snd).concat.(map (step ar_1)).(step ar_2)) (x,0) in
                     min pat_12 pat_21

main::IO()
main=do
  (a:b:q:[])<-return.(map read).words=<<getLine
  dat_s<-forM [1..a] (\_->return.read=<<getLine)
  dat_t<-forM [1..b] (\_->return.read=<<getLine)
  let ar_s = listArray (1,a) dat_s
  let ar_t = listArray (1,b) dat_t
  forM_ [1..q] (\_-> print.(solver ar_s ar_t).read=<<getLine)