#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  int x;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> x;
    sum += x;
  }
  int q;
  cin >> q;
  int a, b;
  while (q--) {
    cin >> a >> b;
    sum -= a;
    sum += b;
    cout << sum << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
