Permute

아직 제출이 없습니다시간 제한1초메모리 제한256 MB

문제

Given a decimal integer ss, you need to permute the digits of ss to obtain a number divisible by 77, or determine that it is impossible.

Leading zeroes in decimal integers are allowed in this problem.

입력

The first line contains an integer TT, the number of test cases (1T1051 \le T \le 10^5). The descriptions of test cases follow.

A test case contains exactly one line with ten integers c_0,c_1c_9c\_0, c\_1 \dots c\_9, where c_ic\_i is the number of digits ii in ss (0c_i1090 \le c\_i \le 10^9, c_i>0\sum c\_i > 0).

출력

For each test case, if it is possible, print the permuted number formatted according to the rules below. Otherwise, print 1-1.

Because the number ss can be very large, you have to print the permuted number in segments, from left to right. First, print a line containing an integer kk, the number of segments (1k1001 \le k \le 100). Then print kk more lines, the ii-th of which will contain two integers r_ir\_i and x_ix\_i, indicating that the ii-th segment of digits in the permuted number consists of r_ir\_i repetitions of the digit x_ix\_i (r_i0r\_i \ge 0, 0x_i90 \le x\_i \le 9).

It can be shown that, if an answer exists, then there also exists an answer which can be represented under the above constraints. If there are several possible solutions, print any one of them.