#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979323846;
int main() {
  unsigned long long n, q, sum = 0, x, y;
  cin >> n;
  unsigned long long a[n + 1];
  for (int i = 1; i <= n; i++) cin >> a[i], sum += a[i];
  cin >> q;
  while (q--) {
    cin >> x >> y;
    sum -= a[x];
    sum += y;
    a[x] = y;
    cout << sum << "\n";
  }
  return 0;
}
