import Control.Monad
import Data.Maybe (fromJust)
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = do
    _ <- readInt
    ts <- readInts
    m <- readInt
    px <- replicateM m readInts
    forM_ px $ \[p, x] -> print $ sum $ replace ts (p - 1) x
    where
        readB = fst . fromJust . B.readInt
        readInt = readB <$> B.getLine
        readInts = map readB . B.words <$> B.getLine
        replace xs i v = take i xs ++ [v] ++ drop (i + 1) xs
