Given n integers, you are asked to answer q queries of the form βWhat would be the greatest common divisor of ALL the numbers between indices l and r?β
Input
The first line of the input contains two integers n (1 β€ n β€ 5000) and q (1 β€ q β€ 10).
The next line contains n space-separated integers representing the given array (1 β€ β€ ).
The next q lines contain pairs of numbers defining the query ranges (0 β€ β€ < n).
Output
The program should print the greatest common divisor for all the numbers between indices l and r inclusive.