401526: GYM100488 M Construct a Permutation
Description
Alex has recently learned the algorithm of finding the longest increasing subsequence of the array. The longest increasing subsequence of the array a1, ..., an is the sequence of numbers ai1, ..., aim, where i1 < ... < im and ai1 < ... < aim, and m — the length of the longest increasing subsequence — is the greatest possible. For instance, in the array such a subsequence is . Of course, the array can contain multiple longest increasing subsequences.
Alex has also figured out that the longest decreasing subsequence can be found by just reversing the array. To verify his guesses and the algorithm's work at all he decided to construct such a permutation that its longest increasing subsequence has length a and its longest decreasing one has length b. Moreover, the permutation must be the largest possible in order to test the performance of the algorithm more carefully. You are to find such a permutation.
InputThe only line contains two integers a and b (1 ≤ a, b ≤ 500) — the required length of the longest increasing and decreasing subsequences correspondingly.
OutputIn the first line output a single integer n — the length of the permutation.
In the second line output the permutation of numbers from 1 to n, satisfying all the requirements.
The length of the permutation n must be the largest possible. If there are multiple solutions, output any of them.
ExamplesInput2 1Output
2Input
1 2
2 2Output
4
2 4 1 3