#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q, b[100007], c[100007], i, a[100007], f = 0, m = 0, l = 0;
  cin >> n;
  vector<int> v;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    v.push_back(a[i]);
    m = m + a[i];
  }
  cin >> q;
  for (i = 0; i < q; i++) {
    cin >> b[i] >> c[i];
    m = m - b[i];
    m = m + c[i];
    cout << m << endl;
  }
  return 0;
}
