Perfect Harmony (Large)

Find the smallest frequency from L to H that divides or is a multiple of every given frequency, else print NO.

Hard8Number theoryNo attempts yetTime limit10sMemory limit512 MB

Problem

Jeff plays in an orchestra. Each of the other NN players has already fixed the sound they will play, and every player plays exactly one sound. Two sounds are in harmony when the frequency of one of them divides the frequency of the other. Harmony is that strict, so the other players are often not in harmony with each other. Jeff wants his own sound to be in harmony with the sound of every other player.

All frequencies are positive integers, so playing frequency 11, or the least common multiple of all the other frequencies, would satisfy the condition. Jeff's instrument, though, can only play frequencies between LL and HH. Decide whether some frequency in that range works, and if one does, find the smallest such frequency.

Input

The first line contains the number of test cases TT. Then TT test cases follow, and each test case is given on two lines.

The first line contains three integers NN, LL, HH separated by spaces. NN is the number of players other than Jeff, and LL and HH are the lowest and the highest frequency Jeff's instrument can play. The second line contains the NN frequencies played by the other players, separated by spaces.

Limits

  • 1T401 \le T \le 40
  • 1N1041 \le N \le 10^4
  • 1LH10161 \le L \le H \le 10^{16}
  • Every frequency is an integer between 11 and 101610^{16}

Output

For each test case, print one line in the form Case #x: y. Here xx is the test case number starting from 11. If no frequency in the range works, print NO in place of yy. Otherwise print the smallest frequency that works.