(ns my.core
  (:require [clojure.string :as str]))

(read)

(def a (map #(Integer/parseInt %) (str/split (read-line) #" ")))

(defn change []
  (let [sum (reduce + a) x (read) y (read)]
    (+ y (- sum (get (vec a) (- x 1))))))

(defn st [_ n]
  (when (> n 0)
    (recur (change) (dec n))))

(st nil (read))