import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Vector.Unboxed as VU
import Data.Bool (bool)

main :: IO ()
main = do
  [a, b, q] <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  ss <- (VU.fromList <$>) . sequence . replicate a $ unsafeTextToInt <$> T.getLine :: IO (VU.Vector Int)
  ts <- (VU.fromList <$>) . sequence . replicate b $ unsafeTextToInt <$> T.getLine :: IO (VU.Vector Int)
  xs <- sequence . replicate q $ unsafeTextToInt <$> T.getLine :: IO [Int]
  let
    dist :: Int -> Int
    dist x = minimum [x - min sL tL, min (x - sL) (tR - x) + (tR - sL), min (x - tL) (sR - x) + (sR - tL), max sR tR - x]
      where
        (sL, sR) = case binaryMaxIndex (< x) ss of
                     Nothing -> (-10 ^ 11, ss VU.! 0)
                     Just i  -> (ss VU.! i, bool (10 ^ 11) (ss VU.! succ i) (i < pred a))
        (tL, tR) = case binaryMaxIndex (< x) ts of
                     Nothing -> (-10 ^ 11, ts VU.! 0)
                     Just i  -> (ts VU.! i, bool (10 ^ 11) (ts VU.! succ i) (i < pred b))
  mapM_ print . map dist $ xs

binaryMaxIndex :: VU.Unbox a => (a -> Bool) -> VU.Vector a -> Maybe Int
binaryMaxIndex p = binaryMaxInt <$> ((p .) . (VU.!)) <*> (,) 0 . pred . VU.length
{-# INLINE binaryMaxIndex #-}

binaryMaxInt :: (Int -> Bool) -> (Int, Int) -> Maybe Int
binaryMaxInt p = check
  where
    check :: (Int, Int) -> Maybe Int
    check ij@(i, _) | not (p i) = Nothing
                    | otherwise = Just $ unsafeBinaryMaxInt p ij
{-# INLINE binaryMaxInt #-}

unsafeBinaryMaxInt :: (Int -> Bool) -> (Int, Int) -> Int
unsafeBinaryMaxInt p = check
  where
    check :: (Int, Int) -> Int
    check ij@(_, j) | p j       = j
                    | otherwise = search ij
    search :: (Int, Int) -> Int
    search = fst . until ((==) <$> fst <*> pred . snd) halve
      where
        halve :: (Int, Int) -> (Int, Int)
        halve (i, j) | p m       = (m, j)
                     | otherwise = (i, m)
          where
            m = (i + j) `div` 2
{-# INLINE unsafeBinaryMaxInt #-}

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}
