#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int INF = 2e9;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  int q;
  cin >> q;
  vector<int> b(q), c(q);
  for (int i = 0; i < (q); i++) cin >> b[i] >> c[i];
  ll ans = 0;
  for (int i = 0; i < (n); i++) ans += a[i];
  for (int i = 0; i < (q); i++) {
    ans += (c[i] - a[b[i] - 1]);
    a[b[i] - 1] = c[i];
    cout << ans << endl;
  }
}
