题号:NC216203
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld
题目描述

has a pile of numbers from

to

.
Please use some of these numbers to construct a multiple of

.
If there are several solutions, please output the
largest one (without leading zeros).
If there is no solution, please output

.
输入描述:
The first line contains a single integer
— the number of test cases.
Each test case has
numbers
represent the amount of
to
.
输出描述:
For each test case, output a positive integer that is a multiple of
, or output
to indicate that there is no such answer.
示例1
输入
复制
5
0 1 0 0 0 0 0 0 1 0
0 1 0 0 0 0 1 0 0 0
0 0 0 0 1 0 1 0 0 0
1 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 20 0
输出
复制
8
16
64
-1
88888888888888888888