#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  long long ans = 0;
  vector<int> a(n);
  for (int i = 0; i < (n); ++i) {
    cin >> a[i];
    ans += a[i];
  }
  int q, x, y;
  cin >> q;
  while (q--) {
    cin >> x >> y;
    ans = ans - x + y;
    cout << ans << endl;
  }
  return 0;
}
