main=interact$unlines.foldr(%)[].words "if"%(a:b:l)=l!!sum[2|a