#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<ll>>;
int main() {
  ll A;
  cin >> A;
  ll b = 0;
  vector<ll> vec(A);
  for (ll i = 0; i < A; i++) {
    cin >> vec.at(i);
    b += vec.at(i);
  }
  ll B;
  cin >> B;
  for (ll i = 0; i < B; i++) {
    ll c, d;
    cin >> c >> d;
    b = b - vec.at(c - 1) + d;
    cout << b << endl;
    vec.at(c - 1) = d;
  }
}
