#include <bits/stdc++.h>
using namespace std;
int n, k;
const int N = 1e5 + 10;
int a[N];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int q;
  cin >> q;
  for (int i = 1; i <= q; i++) {
    int sum = 0;
    int b, c;
    cin >> b >> c;
    a[b] = c;
    for (int i = 1; i <= n; i++) {
      sum += a[i];
    }
    cout << sum << endl;
  }
  return 0;
}
