import Prelude hiding (getLine, getContents, words, lines)
import Data.ByteString.Char8 hiding (map)
import qualified Data.Vector as V
import Data.Vector ((!))
import Data.Maybe (fromJust)

readIntUnsafe :: ByteString -> Int
readIntUnsafe = fst . fromJust . readInt
timeDiff :: V.Vector Int -> ByteString -> Int
timeDiff v l = let [pI,xI] = map readIntUnsafe . words $ l
                   in xI - v ! (pI -1)

main = do
    _ <- getLine
    times <- V.fromList . map readIntUnsafe . words <$> getLine
    let normalTotal = V.sum times
    _ <- getLine
    getContents >>= mapM_ (print . (+ normalTotal) . timeDiff times ) . lines