For Christmas, Larry the magical panda received a board game! This board game consists of a game board with spaces numbered from to , a piece of bamboo, and a set of numbers . Larry opened up and started reading the instructions sheet:
To play the game, start by placing the bamboo in square . Then, perform a series of moves, where a move consists of the following:
If the bamboo is at square , select some number from the set of numbers such that or . Discard from the set of numbers. Then, move the bamboo spaces forwards (allowed if ) or spaces backwards (allowed if ).
If a valid move exists, Larry must make a move. If it is impossible to perform a move, the bamboo is stuck, and the game is over.
Larry made the mistake of boasting to his friends that he could get the bamboo stuck using the minimum number of moves possible, when in reality he possessed no such skill. However, being a magical panda, Larry went home and calculated the minimal number of moves to get the object stuck as well as a valid sequence of moves that accomplishes this task. However, not wanting to be made fun of by his friends, he wants you to check over his work. Please help Larry by calculating the minimum number of moves to get the bamboo stuck as well as a valid sequence of moves that accomplishes this, and he will check his answer against yours!
Constraints
Input Specification
The first and only line consists of two space-separated integers and .
Output Specification
First, output the minimal number of moves required to get the object stuck.
Then, output lines, with the of these lines containing an integer , the number chosen from the set of numbers on the move. This number should be negative if the object was moved backwards, and positive if moved forwards. All over should be distinct, and the object should not exit the game board at any time while performing these moves. In addition, the object must be stuck at the end of these moves.
If is minimized and the sequence of moves is valid, you will receive points for that test case and a verdict of Accepted
. If only is correct, you will receive points for that test case and a verdict of Partially Accepted
. If is incorrect, you will receive points for that test case and a verdict of Wrong Answer
. After a Wrong Answer
verdict, no more test cases will run and judging will terminate.
Your overall score is the minimum number of points achieved over all test cases.
Sample Input 1
5 4
Sample Output 1
2
-2
1
Explanation for Sample Output 1
Initially, the object starts at space and the set of numbers available is .
After the first move, the object moves to space and the set of numbers available after this move is .
After the second move, the object moves to space and the set of numbers available after this move is .
It can now be shown that no more moves can be made and the object is stuck after moves. Moreover, it can be shown that this is the minimum number of moves required.
Sample Input 2
8 8
Sample Output 2
4
-4
-2
-1
3
Sample Input 3
1 1
Sample Output 3
0
Comments