import Control.Monad

ac t ts sp = ts + ((last sp) - (t!!(head sp))) 

main=do
 getLine
 t<-map read.words<$>getLine
 m<-readLn
 spl<-map (map read.words).lines<$>getContents
 let ts = sum t
 putStrLn.unlines$map show$map (ac t ts) spl  