General Knight

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

For the uninitiated, chess is a board game is played on a grid of 8×88 \times 8 squares. The rows are numbered 11 to 88 with row 11 at the bottom and columns are labeled with lowercase aa to hh. The label of a square is its column, then its row. For example, valid square labels are a1a1 and e5e5.

In chess, a piece threatens a square on the board if the piece can move to that square in one move. The knight is one of the more fearsome chess pieces, as it moves differently from the other pieces. In a single move, a knight can move two rows and one column or one column and two rows. The image below shows the squares a standard chess knight threatens if it starts in square e5e5.

The standard chess knight is a (2,1)(2, 1)-knight. The more general version is an (a,b)(a, b)-knight, which in one move can move either aa rows and bb columns, or bb rows and aa columns. Citizens of the chessboard are concerned, as they don't know how powerful these new knights are. Given an (a,b)(a, b)-knight and its starting square, which squares does it threaten?

입력

Input consists of two lines. The first line has two space-separated integers aa and bb, the properties of the knight. It is guaranteed that 0a,b<80 \leq a, b < 8 and max(a,b)>0\max(a, b) > 0. The second line contains the starting location of the (a,b)(a, b)-knight. This is given in standard chess notation as described above.

출력

First, output an integer kk, the number of squares the knight can reach. On the second line, output kk space separated strings, the positions the knight can move to in exactly one move. Sort these positions in increasing column order, breaking ties by increasing row.