{-# LANGUAGE BangPatterns #-}
import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as V

main :: IO ()
main = readLine >>= main'
    where
        main' abq = readf abq >>= printRes . solve
        readf [a, b, q] = (,,) <$> rf a <*> rf b<*> rf q 
        rf = flip replicateM (head <$> readLine)
        printRes = mapM_ print

solve :: ([Int], [Int], [Int]) -> [Int]
solve (ss, ts, qs) = map answer qs
    where
        answer q = minimum [v0, v1, v2, v3, v4, v5]
            where
                !v0 = max sdr tdr
                !v1 = max sdl tdl
                !v2 = 2 * sdl + tdr
                !v3 = 2 * tdl + sdr
                !v4 = 2 * sdr + tdl
                !v5 = 2 * tdr + sdl

                !sdr = sr - q
                !tdr = tr - q
                !sdl = q - sl
                !tdl = q - tl

                !(sl, sr) = edit vas $ binarySearch q vas
                !(tl, tr) = edit vbs $ binarySearch q vbs

        edit vs (Right i) = (x, x)
            where
                x = vs V.! i
        edit vs (Left i)
            | i == 0 = (-inf, r)
            | i == V.length vs = (l, inf)
            | otherwise = (l, r)
            where
                l = vs V.! (i - 1)
                r = vs V.! i

        vas = V.fromList ss
        vbs = V.fromList ts
        
        inf = 10 ^ 11

readLine :: IO [Int]
readLine = unfoldr (fmap (second (maybe B.empty snd . B.uncons)) . B.readInt) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine

--binarySearch :: (Ord a) => a -> V.Vector a -> Either Int Int
binarySearch k !xs
    | V.null xs = Left 0
    | otherwise = bsf 0 $ V.length xs
    where
        bsf !base !size
            | size > 1 && mv > k = bsf base $ size - half
            | size > 1 = bsf mid $ size - half
            | bv == k = Right base
            | bv < k = Left $ base + 1
            | otherwise = Left base
            where
                half = size `div` 2
                !mid = base + half
                bv = xs V.! base
                mv = xs V.! mid
{-# INLINE binarySearch #-}