#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long int inf = 1e18;
const double pi = 3.1415926535897932384626;
int sum(int a[], int n) {
  int s = 0;
  for (int i = 0; i < n; i++) {
    s += a[i];
  }
  return s;
}
void solve() {
  int n, q;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cin >> q;
  int b[q], c[q], s[q];
  for (int i = 0; i < q; i++) cin >> b[i] >> c[i];
  for (int i = 0; i < q; i++) {
    replace(a, a + n, b[i], c[i]);
    cout << sum(a, n) << endl;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
