시간 제한메모리 제한제출정답맞힌 사람정답 비율
0.5 초 1024 MB104466.667%

문제

Kaloyan was preparing an exam for his students and found the following problem to be pretty interesting. He wrote two numbers $X$ and $Y$ and wants to find a sequence of integers where the sum of every $X$ consecutive elements (in the sequence) is strictly positive while the sum of every $Y$ 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 $Q$ such pairs $X$ and $Y$. Additionally, you have to find a maximal sequence only for the first query.

입력

The only line of the standard input contains one number $Q$ - the number of queries. Each of the following $Q$ lines contains two numbers - $X$ and $Y$ .

출력

On the first line of the standard output you should print $Q$ numbers - $N_1, N_2, \dots, N_Q$, separated with intervals, where $N_i$ is the answer for the $i^{th}$ query. On the second line you should print $N_1$ integers separated with intervals - a sequence with the desired property for the first query.

제한

  • $1 \leq X,Y \leq 100\ 000$
  • $1 \leq Q \leq 100\ 000$

서브태스크

Subtasks Points Required subtasks Other constraints
1 3 For every query: $x=y$
2 4 1 For every query: $x$ divides $y$ or $y$ divides $x$
3 9 $X,Y \leq 5$, $Q=1$
4 12 $|X-Y| = 1$
5 15 3 $X,Y,Q \leq 100$
6 22 3, 5 $X,Y,Q \leq 10000$
7 35 1, 2, 3, 4, 5, 6 No additional constraints.

예제 입력 1

3
3 5
1 5
4 2

예제 출력 1

6 4 3
5 -7 5 3 -7 5

채점 및 기타 정보

  • 예제는 채점하지 않는다.