404503: GYM101521 G Monorail
Description
Monorail is a game featured in the Korean game show "The Genius". The main objective of Monorail is to form a loop using straight and curved track tiles. Here, we present a modified version of the game.
Percy is the only player and is given N straight tile and M curved track tiles. To win the game, he must place ALL of his tiles in a grid not larger than 100 × 100. Together, the tracks must be connected to form one single loop.
For example, a possible solution for N = 2 and M = 8 is shown below:
Help Percy determine if a solution exists, and if so, propose a valid solution.
InputThe only line consists of two integers N and M, the number of straight track tiles and curved track tiles respectively.
For all input, 0 ≤ N, M ≤ 100 and N + M > 0.
OutputIf there is no solution, output Impossible.
Otherwise, output any valid solution. The first line should contain two integers, H and W, separated by a space. You are free to choose 1 ≤ H ≤ 100 and 1 ≤ W ≤ 100 as long as the grid is large enough for your solution. It is guaranteed that if there is a solution, then there exists a solution that fits in a 100 × 100 grid.
Then output the solution grid of height H and width W, consisting of the following characters:
- .: Empty cell
- -: Straight track tile (Figure 1a)
- |: Straight track tile (Figure 1b)
- 7: Curved track tile (Figure 2a)
- J: Curved track tile (Figure 2b)
- L: Curved track tile (Figure 2c)
- r: Curved track tile (Figure 2d)
Note: J, L and r are case-sensitive.
ExamplesInput2 8Output
3 4Input
r-7.
L7L7
.L-J
0 4Output
4 4Input
....
.r7.
.LJ.
....
6 2Output
Impossible