#include<iostream>
using namespace std;

int main(){
  int n; cin >> n;
  int a[n] = {};
  int sum = 0;
  for(int i = 0; i < n; i++){
  	cin >> a[i];
    sum += a[i];
  }
  int q;cin >> q;
  for(int i = 0; i < q; i++){
  	int b,c;
    cin >> b >> c;
    int tmp = (sum - a[b] + c);
    cout << tmp << endl;
    a[b] = c;
    sum = tmp;
  }
  return 0;
}