import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    ts <- getIntList
    m <- getInt
    let s = zipWith (+) (scanl (+) 0 ts) (tail (scanr (+) 0 ts))
    replicateM_ m $ do
        [p, x] <- getIntList
        print $ s !! (p - 1) + x