XY
시간 제한0.5초메모리 제한1024 MB
여러 쌍 X, Y에 대해 연속한 X개 항의 합은 양수, 연속한 Y개 항의 합은 음수가 되도록 하는 정수 수열의 최대 길이를 구하고, 첫 질의의 수열을 출력한다.
문제
Kaloyan was preparing an exam for his students and found the following problem to be pretty interesting. He wrote two numbers and and wants to find a sequence of integers where the sum of every consecutive elements (in the sequence) is strictly positive while the sum of every consecutive elements is strictly negative.
Kaloyan found out that this sequence cannot be infinitely long. He tried to find a sequence of maximum possible length with the described property. However, it turns out to be rather difficult problem for Kaloyan. Help him by writing a program XY that finds the maximum length of such a sequence. You should find the answers to such pairs and . Additionally, you have to find a maximal sequence only for the first query.
입력
The only line of the standard input contains one number - the number of queries. Each of the following lines contains two numbers - and .
출력
On the first line of the standard output you should print numbers - , separated with intervals, where is the answer for the query. On the second line you should print integers separated with intervals - a sequence with the desired property for the first query.