$$M = \begin{pmatrix}
t_{n-1} & t_n & t_{n+1} & \cdots & t_{2*n-3} & t_{2*n-2}\\
t_{n-2} & t_{n-1} & t_n & \cdots & t_{2*n-4} & t_{2*n-3}\\
t_{n-3} & t_{n-2} & t_{n-1} & \cdots & t_{2*n-5} & t_{2*n-4}\\
\vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\
t_1 & t_2 & t_3 & \cdots & t_{n-1} & t_n\\
t_0 & t_1 & t_2 & \cdots & t_{n-2} & t_{n-1}\\
\end{pmatrix}$$
You are expected to write a program to point out some elements of $M*M$.
Input
Multi test cases (about 100), every case occupies two lines.
The first line contains an integer n.
Then second line contain 2*n-1 integers $t_0, t_1, t_2, t_3, \ldots, t_{2*n-4}, t_{2*n-3}, t_{2*n-2}$ separated by exact one space.
The third line contains an integer m, indicates the number of query.
Next m lines will give queries
$\begin{matrix}
r_0 & c_0\\
r_1 & c_1\\
r_2 & c_2\\
\vdots & \vdots\\
r_{m-1} & c_{m-1}
\end{matrix}$
For $r_0, c_0$ the program will query the element of $M*M$ which locates in the $r_0^{th}$ row, $c_0^{th}$ column. For $r_i, c_i(0
Output
For each case£Ĵoutput the sum of the answer of each query.