Given a sequence . You need to perform m queries on it.
In each query, two parameters are given, and we let
In this statement, t is a given constant, which can be 0 or 1. And is the answer of last query, with initial value is 0.
You need to find a pair , satisfies , and maximize .
The answer of this query is .
Input
The first line contains three integers, n, m, and t.
The second line contains n integers, representing the sequence a.
The next m lines, each line contains two integers, x and y.
Output
For each query, output an integer represents the answer.
Constraints
The actual queries are .
You can choose as to maximize the value.