Classical Geometry Problem

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

You've just bought a new lamp that can emit light of any color! However, its controls are a bit tricky.

We will represent colors as triples (r,g,b)(r, g, b) of real numbers between 00 and 255255, inclusive. The lamp controller has eight buttons, one for each of the basic colors: black (0,0,0)(0, 0, 0), red (255,0,0)(255, 0, 0), green (0,255,0)(0, 255, 0), blue (0,0,255)(0, 0, 255), cyan (0,255,255)(0, 255, 255), magenta (255,0,255)(255, 0, 255), yellow (255,255,0)(255, 255, 0), and white (255,255,255)(255, 255, 255).

When you push the button of color cc, the color of the lamp is linearly changing towards cc, at the speed of 11 unit of distance per second. Once the color of the lamp reaches cc, it stops changing. However, you can also stop pushing the button at any earlier moment, leaving the lamp color in some intermediate state. It is not allowed to push two or more buttons at the same time.

Formally, each button push is described by a basic color (r_c,g_c,b_c)(r\_c, g\_c, b\_c), where each of r_cr\_c, g_cg\_c, and b_cb\_c is equal to either 00 or 255255, and a non-negative real number dd. Let pp and c=(r_c,g_c,b_c)c = (r\_c, g\_c, b\_c) be the 3D points corresponding to the current lamp color and to the button color, and let v=cp\overrightarrow{v} = c - p be the vector between them. If p=cp = c, pushing this button does nothing. Otherwise, if you push the button for dd seconds, the lamp color will change to p+vvmin(d,v)p + \frac{\overrightarrow{v}}{|\overrightarrow{v}|} \cdot \min(d, |\overrightarrow{v}|).

You are given a target color (r,g,b)(r, g, b), where rr, gg, and bb are integers. Initially, the lamp is black. Find any sequence of at most 1010 button pushes that changes its color to (r,g,b)(r, g, b). It is guaranteed that such a sequence always exists.

입력

Each test contains multiple test cases. The first line contains the number of test cases tt (1t1041 \le t \le 10^4). The description of the test cases follows.

The only line of each test case contains three integers rr, gg, and bb, denoting the target color (0r,g,b2550 \le r, g, b \le 255).

출력

For each test case, print an integer mm, denoting the number of button pushes in your sequence (0m100 \le m \le 10).

Then, print mm lines, describing button pushes in your sequence in chronological order. Each of these lines must contain three integers r_cr\_c, g_cg\_c, and b_cb\_c, followed by a real number dd (r_c,g_c,b_c0,255r\_c, g\_c, b\_c \in \\{0, 255\\}; 0d1040 \le d \le 10^4).

Your answer will be considered correct if the distance between point (r,g,b)(r, g, b) and the point corresponding to the lamp color after your sequence does not exceed 10610^{-6}.

You do not have to find the shortest sequence. If there are multiple solutions, print any of them.