import Data.List hiding (find)
import Control.Monad
import Debug.Trace


range :: [Int] -> Int -> (Int,Int) -- s s t t
range [] _ = error "rangeE"
range (a:b:ls) x = if a <= x && x <= b || x <= a then (a,b)
  else if ls == [] then (a,b)
    else range (b:ls) x

find :: [Int] -> [Int] -> IO ()
find as bs  = do
   x <- read <$> getLine
   let (s1,s2) = range as x
       (t1,t2) = range bs x
   print $ minimum [2*s1+t2, 2*t1+s2, 2*s2+t1, 2*t2+s1 , max s1 t1, max s2 t2]

main :: IO ()
main = do
    [a,b,q] <- map read.words <$> getLine :: IO [Int]
    as <- replicateM a $ read <$> getLine
    bs <- replicateM b $ read <$> getLine
    print "------------"
    replicateM_ q $ find as bs
