#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t;
  long long int n, ae, b;
  cin >> n;
  long long int a[n], sum = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  cin >> t;
  while (t--) {
    cin >> ae >> b;
    sum -= ae;
    sum += b;
    cout << sum << '\n';
  }
}
