GCD, Sum, Multiply. What?...
The author has used up all the creative skills on previous problems, so Anton won't be tortured in this statement. He will just give you an interesting problem.
You are given an array consisting of integers. You are also given queries . For each query, find the maximum value of over all pairs (), where
;
— the sum of all numbers in the segment ;
— the greatest common divisor of all numbers in the segment .
The greatest common divisor of two numbers and is the largest positive integer that divides both and .
The greatest common divisor of a set of numbers is the largest positive integer that divides all elements of the set.
Input
The first line contains two integers , () — the number of elements in the array and the number of queries, respectively.
The second line contains integers () — the description of the array.
Each of the next lines contains two integers , () — the description of the queries.
Output
Print integers — the answers to the queries.
Examples
Note
In the first example, there are following segments:
— = = ;
— = = ;
— = = ;
— = = ;
— = = ;
— = = .
Scoring
( points): ;
( points): ;
( points): ;
( points): ;
( points): ;
( points): ;
( points): ;
( points): ;
( points): no additional constraints.