import Control.Monad

main = do
	_ <- readLn :: IO Int
	times <- map read.words <$> getLine
	m <- readLn
	drinks <- replicateM m getLine
	mapM_ (putStrLn.show) $ map (calc times.map read.words) drinks

calc times [p,x] = sum times - (times !! (p-1)) + x