Sparse Tables
Very easy
Execution time limit is 2 seconds
Runtime memory usage limit is 128 megabytes
The array with integers is given. Write a program that answers the question: find the minimum on a segment between and inclusively.
Input
The first line contains three positive integers and — the number of elements in array, the number of queries and the first element in an array respectively. The second line contains two positive integers and — the first query.
The elements are given with the next formula:
For example, if , we get the next array:
The queries are generated this way:
where is the answer to the -th query.
Output
Print and (the values for the last query and the answer to it).
Examples
Input #1
Answer #1
Submissions 3K
Acceptance rate 29%