import Control.Monad
ac tn t p = tn-((t!!(head p))-last p) 
main=do
 getLine
 t<-map read.words<$>getLine
 m<-readLn
 px<-replicateM m (map read.words<$>getLine)
 putStrLn$unlines$map show$map (ac (sum t) t) px
