Saturn Bees

On a torus-like hexagonal grid, decide whether nm/4 vertices can each dominate a closed neighborhood of 4 vertices, covering every vertex.

Hard8MathCombinatoricsImplementationBrute forceNo attempts yetTime limit2sMemory limit512 MB

Problem

The Saturn bee (Apis saturnii) builds its hive in the shape of a ring. A beehive is a hexagonal grid, and we model it as a graph whose edges are walls and whose vertices are the joins between walls. Flatten every hexagon a little so that it becomes a 1×21 \times 2 rectangle. Then every vertex gets an integer coordinate, and vertex (i,j)(i, j) is adjacent to (i,j1)(i, j-1), to (i,j+1)(i, j+1), and to (i+1,j)(i+1, j) when i+ji+j is odd or to (i1,j)(i-1, j) when i+ji+j is even.

To turn an n×mn \times m grid into a ring the edges wrap around. If nn and mm are both even, an edge with endpoint (n,j)(n, j) ends at (0,j)(0, j) instead, and an edge with endpoint (i,m)(i, m) ends at (i,0)(i, 0). If one of the two numbers is odd, the bees twist the grid so that both sides match: if nn is odd then (n,j)(n, j) becomes (0,j+1)(0, j+1), and if mm is odd then (i,m)(i, m) becomes (i+1,0)(i+1, 0). The swarm mind knows the handshaking lemma and never builds a beehive in which nn and mm are both odd. Figure A.1 shows a few beehives.

Figure A.1: Example beehives

Each soldier bee sits on a vertex and controls that vertex together with the 3 vertices adjacent to it. The swarm mind knows that nm/4nm/4 bees are needed to control the whole hive, so the swarm carries exactly that many soldiers. Some beehives turn out to be hard to guard, and the Saturn bees refuse to live there.

Decide whether a beehive is a suitable home for a swarm.

Input

The first line contains two integers nn and mm (2m,n100002 \le m, n \le 10\,000). At least one of nn and mm is even.

Output

Print possible if nm/4nm/4 bees can guard an n×mn \times m beehive, and impossible otherwise. If nmnm is not divisible by 4 the swarm cannot be assembled, so print impossible.