Hide

Problem C
Paint By Sine

/problems/vths21.paintbysine/file/statement/en/img-0001.png
Paint By Sine

“Paint-by-Sine” has become the latest craze in the world of Modern Art. To create a “Paint-by-Sine” painting, all that’s needed are two sinusoidal functions $B(x) = \sin (a x + b)$ and $R(x) = \sin (c x + d)$ called the blue function and red function, respectively. To complete a “paint-by-sine” painting, add the rectangle on the Cartesian plane whose corners are $(L, 1)$, $(R, 1)$, $(R, -1)$, and $(L, -1)$ for some values $L$, $R$ with $L < R$.

Now floodfill with four colors: everything that is inside the rectangle and above both functions is filled green, everything that is below both functions is filled yellow, and those areas that are between the $2$ functions are filled with red or blue, depending on which of the two functions forms the upper boundary of such a region.

To help better plan for the expected onslaught in demand for paint in the age of supply chain shortages, write a program that computes how much green, yellow, red, and blue paint is necessary to complete a painting.

Input

The first line of input contains an integer $n$ ($1 \le n \le 25$), which is the number of test cases to follow. Each test case consists of six space-separated real numbers $a$, $b$, $c$, $d$, $L$, and $R$ with no more than $3$ digits after the decimal point. You may assume that $-\pi \le b, d \le \pi $, $-10 \le a, c \le 10$, $a \ne 0$, $c \ne 0$, $(a, b) \ne (c, d)$, and $-1\, 000 \le L, R \le 1\, 000$.

Output

Process each test case separately and output $n$ lines. On each line, output the total size of the areas that are painted in green, yellow, red, and blue, in this order, for the respective test case. Assume that the functions themselves and the border of the rectangle have zero width, i.e., occupy zero area. Your answer will be considered correct if it is within an absolute error of $10^{-6}$ of the real answer.

Sample Input 1 Sample Output 1
2
1 -0.1 1.2 1.7 -1 7
10 1 9 2 -1000 1000
2.996450597881646 4.0161139042314975 5.365678380818133 3.6217571170687237
1189.2078507051312 1189.280778479288 810.8435824230145 810.6677883925526

Please log in to submit a solution to this problem

Log in