404985: GYM101726 H Understanding the sorobov

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. Understanding the sorobovtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Instruments for calculation have existed for centuries. Long before the invention of calculators in the XVII century, Chinese and Japanese made use of abacus with which they could do sophisticated mathematical operations in an astonishing speed. A similar instrument was recently discovered in digging sites near the city of Yekaterinburg. It is believed to be an abacus similar to the Japanese one, called, in Russian, sorobov (copoбob).

The sorobov has nine columns, each corresponding to a digit. The rightmost column represents the unit value, the second-to-right represents the tens, then the hundreds and so on. There are seven rows, the first two being separated from the last five by a line. In the upper part (two first lines), each column contains a single pebble that, when positioned next to the separating line, adds 5 to the value of the corresponding digit. In the lower part, each column has 4 pebbles and an empty space, and the number of pebbles between the separating line and the empty space is added to the value of the corresponding digit. That way, we say that the pebbles in the top are worth 5 units and the ones in the bottom are worth 1.

How to represent the digits from 0 to 9.

Your task is: Given a number N, print its representation using the sorobov.

Input

On the first line T, the number of test cases.

Each test case consists of a single integer N.

Limits

  • 1 ≤ T ≤ 104
  • 0 ≤ N < 109
Output

For each test case, print the representation of the number N in the sorobov using the following format. The two first lines correspond to the pebbles that are worth 5 units. In the third line print --------- (nine hyphens). In the next five lines, print the pebbles that are worth 1. Each line representing pebbles should contain exactly nine characters, where "0" corresponds to an empty space and "1" to a pebble.

Print an empty line after each test case (including the last).

ExampleInput
2
2
16
Output
111111111
000000000
---------
000000001
111111111
111111110
111111111
111111111

111111110
000000001
---------
000000011
111111100
111111111
111111111
111111111

Source/Category

加入题单

算法标签: