RoAlgo Contest #7 | divnr

This was the problem page during the contest. Access the current page here.
Time limit: 0.05s Memory limit: 64MB Input: Output:

"the checker is impossible for this one"

Well, Traian needed more problems for the contest, so he thought of this one.

Task

Traian thought of tt sequences each containing nn numbers (for each sequence, the number nn is not necessarily the same) and also thought of a number mm for each sequence (again, mm is not necessarily the same for all sequences). He wants you to find a number that is divisible by every number in the sequence and has exactly mm digits.

Input data

The first line will contain the number tt, representing the number of sequences. On the 2i2 \cdot i-th line, there will be the numbers nn and mm. On the 2i+12 \cdot i + 1-th line, there will be the nn numbers in the sequence.

Constraints and clarifications

  • 1n21051 \leq n \leq 2 \cdot 10^5
  • 1m1051 \leq m \leq 10^5
  • The sum of the numbers nn does not exceed 21052 \cdot 10^5
  • The sum of the numbers mm does not exceed 10510^5
  • The required number exists for any of the tt sequences.
  • We denote the sequence by aa
  • 1ai109 (1in)1 \leq a_i \leq 10^9 \ (1 \leq i \leq n)
  • 1a1a2...an1091 \leq a_1 \cdot a_2 \cdot ... \cdot a_n \leq 10^9

Example

stdin

9
4 11
113 158 170 96 
5 10
22 18 6 30 6 
11 9
4 6 5 4 5 3 6 4 5 4 3 
6 11
28 9 9 25 6 17 
3 10
565 623 621 
11 9
2 4 2 3 3 5 4 3 4 4 6 
3 10
920 274 410 
10 11
3 1 5 7 1 3 5 2 4 7 
4 9
30 90 40 26 

stdout

10052516160
6000005880
100000020
80000272800
1092944475
900000180
3007566480
50000000400
100002240

Explanation

Check them

Log in or sign up to be able to send submissions!