import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
void main()
{
    auto n = lread();
    auto t = aryread();
    // writeln(t);
    auto m = lread();
    auto px = new long[][](m, 2);
    foreach (i; 0 .. m)
    {

        px[i] = aryread();

    }
    // writeln(px);
    foreach (i; 0 .. m)
    {
        writeln(px[i][1] + (sum(t[0 .. (px[i][0] - 1)])) + (sum(t[px[i][0] .. $])));

    }
}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}
