Mojtba has an array a with n elements and an integer k. Arpa has q query in type [L,R], for i-th query print the length of the shortest segment [x,y]∈[Li,Ri], such that k|∏yj=xaj.
Input Format
The first line of input will contain three integers, n,k,q (1≤n,q≤5⋅105, 1≤k≤109).
Next line will contain n integers a1,a2,a3,...,an - integers of the array a (1≤ai≤109).
In i-th line of the next q lines, two integers given, Li,Ri (1≤Li≤Ri≤n).
Output Format
For each query print the length of the shortest segment [x,y]∈[L,R], such that k|∏yi=xai. If there is no segment satisfying the condition, print −1.
In the first query, [2,7] the segment [3,4] belongs to it and has the product 6 which is divisible by k=6. Its size is 2 so the answer for that query is 2.