404503: GYM101521 G Monorail

Memory Limit:64 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

G. Monorailtime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard output

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.

Input

The 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.

Output

If 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.

ExamplesInput
2 8
Output
3 4
r-7.
L7L7
.L-J
Input
0 4
Output
4 4
....
.r7.
.LJ.
....
Input
6 2
Output
Impossible

加入题单

算法标签: