CSES - Aalto Competitive Programming 2024 - wk10 - Mon - Modern art
  • Time limit: 1.00 s
  • Memory limit: 512 MB

Alice asks you to create a piece of art with very specific dimensions: you need to draw a single, connected figure so that the surface area of the figure is A and the perimeter of the figure is P.

More precisely, your drawing has to be a black-and-white bitmap image: a figure that consists of black pixels, on a background that consists of white pixels. You can choose the canvas size freely. All pixels at the boundary of the canvas have to be white. The figure has to be connected: between every pair of black pixels s and t there is a path from s to t where each step goes up, down, left or right and all the pixels are black along the way.

The surface area A of the figure is the number of black pixels. The perimeter P is the number of horizontal or vertical edges between black and white pixels.

Input

A single line contains two integers A and P.

Output

Output a single line with the word "IMPOSSIBLE" if there is no drawing that meets these constraints, and otherwise the word "POSSIBLE" followed by a valid drawing. If the canvas that you have chosen is x pixels wide and y pixels high, you will need to output y rows, each with x characters, and each character is either 0 (representing a white pixel) or 1 (representing a black pixel).

Constraints

  • 1 \leq A \leq 1000
  • 4 \leq P \leq 4 \times A

Example 1

Input:

2 6

Output:

POSSIBLE
0000
0110
0000

Example 2

Input:

2 7

Output:

IMPOSSIBLE

Example 3

Input:

3 8

Output:

POSSIBLE
0000
0110
0010
0000