import Control.Applicative ((<$>))
import Control.Monad (replicateM, forM_)

main = do
  n <- read <$> getLine :: IO Int
  ts <- fmap read <$> words <$> getLine :: IO [Int]
  m <- read <$> getLine :: IO Int
  pxs <- replicateM m (fmap read <$> words <$> getLine :: IO [Int])
  let _sum = sum ts in
    forM_ [0..m-1] $ \i -> do
      putStrLn $ show $ _sum - (ts !! (pxs !! i !! 0 - 1)) + (pxs !! i !! 1)
