import Data.Maybe (isJust, fromJust)
import Data.Array

main :: IO ()
main = do
  [a, b, q] <- map read . words <$> getLine
  ss <- sequenceA . replicate a $ read <$> getLine
  ts <- sequenceA . replicate b $ read <$> getLine
  xs <- sequenceA . replicate q $ read <$> getLine
  let
    ss' = listArray (1, a) ss
    ts' = listArray (1, b) ts
    f x = min (g sgl tgl) (g tgl sgl)
      where
        sgl = lg ss'
        tgl = lg ts'
        lg = sequenceA . sequenceA [lookupLT, lookupGT] $ x
        g sgl tgl = minimum . map fromJust . filter isJust . map ((snd . foldl (\(y, d) -> (,) <$> id <*> (d +) . dist y) (x, 0) <$>) . sequenceA) . sequenceA $ [sgl, tgl]
  mapM_ (print . f) xs

dist x y = toInteger . abs $ y - x

lookupLT x ys
  | ys ! l0 >= x
    = Nothing
  | ys ! r0 < x
    = Just $ ys ! r0
  | otherwise
    = lr (l0, r0)
  where
    (l0, r0) = bounds ys
    lr (l, r)
      | r <= l + 1
        = Just $ ys ! l
      | ys ! m < x
        = lr (m, r)
      | otherwise
        = lr (l, m)
      where
        m = (l + r) `div` 2

lookupGT x ys
  | ys ! r0 <= x
    = Nothing
  | ys ! l0 > x
    = Just $ ys ! l0
  | otherwise
    = lr (l0, r0)
  where
    (l0, r0) = bounds ys
    lr (l, r)
      | r <= l + 1
        = Just $ ys ! r
      | ys ! m > x
        = lr (l, m)
      | otherwise
        = lr (m, r)
      where
        m = (l + r) `div` 2
