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

(read)

(def line "2 1 4")

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

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

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

(st nil (read))