DIVIDE IT

0

0 votes
Problem

Given a list a n numbers , you have to find if its possible that there exists a number X in range L and R [ both inclusive ] such that for each number i in the list , X divides i or i divides X. If there exits multiple answers for X , find the least possible one.

Constraints

1 ≤ T ≤ 50

1 ≤ N ≤ 10^4.

1 ≤ L ≤ R ≤ 10^16

All the numbers in the list are less than 10^16.

Input Format

First line of the input contains T , Number of test cases. First line of each test case contains N , L , R and second line contains N numbers

Output Format

Print X for each test case, If there exits no answer then print -1.

Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

T1 : There exits not x such that [ it divides ] or [ is divided ] by all the numbers in the list because they are prime. the least possible X will be 1 and then 385 [ 5711 ] but they are not in the range given [5,20]

T2 : Least possible answer is 1 but thats not in the range so next one is 10 and its in the range so answer is 10.

Editor Image

?