import Control.Monad (replicateM_)
import qualified Data.Vector.Unboxed as V

main :: IO ()
main = do
    _ <- getLine
    ts <- V.fromList . fmap read . words <$> getLine :: IO (V.Vector Int)
    m <- readLn :: IO Int
    replicateM_ m $ do
        [p, x] <- fmap read . words <$> getLine :: IO [Int]
        let us = ts V.// [(p - 1, x)]
        print $ V.sum us
