import std.stdio;
import std.algorithm;
import std.conv;
import std.string;

void main() {
    auto n = readln.chomp.to!(long);
    auto t = readln.split.to!(long[]);
    auto m = readln.chomp.to!(long);
    long[] p;
    long[] x;
    long s = sum(t);

    foreach (i; 0..m){
        auto px = readln.split.to!(ulong[]);
        (s - t[px[0] - 1] + px[1]).writeln;
    }
}
