You are given a sequence of numbers and queries:
0 a b val
: the number will be added to all of the numbers from the interval1 a b
: you need to print the minimum even number and the maximum odd number from the interval ; if one of these numbers does not exist, will be printed in its place
Task
Answer all of the type 1 queries.
Input data
The first line contains one integer . The second line contains integers, representing the numbers from the sequence. The third line contains one integer , and the following lines contain queries, as described in the statement.
Output data
The output contains the answers to all of the type 1 queries, one per line.
Constraints and clarifications
- The numbers from the sequence are between and .
- The numbers from type 0 queries are between and .
- WARNING! If one of the answers to a type 1 query cannot be calculated, will be printed in its place!
# | Points | Constraints |
---|---|---|
1 | 30 | |
2 | 30 | There are no type 0 queries. |
3 | 40 | No additional constraints |
Example
stdin
7
5 6 3 1 9 8 5
10
1 2 5
0 2 3 2
1 2 4
0 2 7 3
1 2 4
1 4 7
0 5 7 1
1 1 6
1 1 2
1 3 4
stdout
6 9
8 5
4 11
4 11
4 13
-1 11
4 -1
Explanation
The initial sequence is: .
Query 1 2 5
: You will print the specified two numbers from the interval .
Query 0 2 3 2
: The new sequence is .
Query 1 2 4
: You will print the specified two numbers from the interval .
Query 0 2 7 3
: The new sequence is .
Query 1 2 4
: You will print the specified two numbers from the interval .
Query 1 4 7
: You will print the specified two numbers from the interval .
Query 0 5 7 1
: The new sequence is .
Query 1 1 6
: You will print the specified two numbers from the interval .
Query 1 1 2
: You will print the specified two numbers from the interval .
Query 1 3 4
: You will print the specified two numbers from the interval .