#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a, s = 0;
  for (int i = 0; i < n; i++) {
    cin >> a;
    s += a;
  }
  int k, i, j;
  cin >> k;
  while (k--) {
    cin >> i >> j;
    s += (j - i);
    cout << s << endl;
  }
  return 0;
}
