Two friendly frog families are standing on a line of stones numbered to from left to right. The first family consists of frogs standing on the stones numbered from to , each of the frogs facing to the right. The second family consists of frogs standing on the stones numbered from to , each of the frogs facing to the left.
The frog families are now going on a family trip! The first family wants to stand on the stones numbered from to , whereas the second family wants to stand on the stones numbered from to . To reach these stones, any frog can perform any number of the following hops:
- If there is at least one stone in the direction that the frog faces and the stone directly in front of the frog does not have a frog on it, hop to that stone.
- If there are at least two stones in the direction that the frog faces, the stone directly in front of the frog is occupied by a frog from the other family, and the stone behind the other frog does not have a frog on it, hop to that stone.
Given these conditions, is it possible for all the frogs to reach their desired stones? If it is, please find the shortest sequence of hops that achieves it.
Constraints
Subtask 1 [10%]
Subtask 2 [40%]
Subtask 3 [50%]
No additional constraints.
Input Specification
The first and only line contains integers and .
Output Specification
If it is impossible for all the frogs to reach their desired stones, output .
Otherwise, the first line of your output should contain an integer , the minimum number of jumps required for all the frogs to reach their desired stones.
Then, the -th of the next lines should contain an integer , representing that the frog on stone should perform one of the possible hops as the -th hop in your solution.
Scoring
For each test case, your output should satisfy the following requirement:
- The integer on the first line of output must be correct.
If the integer on the first line is not , then your output should satisfy the following additional requirements:
- For each , there must be a frog on stone and it should be able to perform exactly one of the two hops.
- After performing the hops given, the first family of frogs should be on stones to and the second family of frogs should be on stones to .
If your output satisfies all of the necessary requirements, you will receive Accepted
for that test case. Otherwise, you will receive Wrong Answer
.
Sample Input
2 2
Sample Output
8
1
3
4
2
0
1
3
2
Comments