
function main(s) {

  s = s.split('\n');

  const q = s[1].split(' ').map(n => Number(n));
  const drink = s.slice(3, -1).map(l => l.split(' ').map(n => Number(n)));

  const base_sum = q.reduce((a, b) => a + b);
  const ans = [];

  for (let i = 0; i < drink.length; i++) {
    const nsum = base_sum + (drink[i][1] - q[drink[i][0] - 1]);
    ans.push(nsum);
  }

  console.log(ans.join('\n'));
}

