XiaoYang is building a big system, which uses the pattern of Command Query Responsibility Segregation.
This system holds an array of numbers of length n, where
for all
. And it is designed for a function f(L, R).
You are developing this system with XiaoYang. Now, Q queries are here for the sequence with . Each query contains two number L, R. You should respond to these queries with the result of that function.
The input starts with one line, containing integers
.
Then follow Q lines, each containing integersdenoting the query parameters.
For each query, output the answer in one line.