#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, q;
  cin >> n;
  long long a[100002];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long sum = 0;
  for (int i = 0; i < n; i++) sum += a[i];
  cin >> q;
  while (q--) {
    int b, c;
    cin >> b >> c;
    sum += c - b;
    cout << sum << endl;
  }
}
