import Data.Array.IArray

main = do
    getLine
    times <- map read . words <$> getLine
    getLine
    drinks <- map read . words <$> getContents
    let times' = listArray (1,length times) times :: Array Int Int
    let time = sum times
    mapM_ (print . (-) time) $ map (\(p, x) -> times'!p - x) $ tuplify drinks

tuplify (x:y:xs) = (x,y):tuplify xs
tuplify [] = []
