Submit solution

Points: 10
Time limit: 1.0s
Memory limit: 64M
PyPy 3 128M
Python 3 128M

Author:
Problem type

Tommy loves lemons, especially those from the lemon tree under the moon. He also likes to eat lemons, but eating too many lemons can make him drunk. Tommy doesn't want to get drunk, so he asks you to find out exactly how much of the lemon he is eating to ensure that he won't be drunk. Help Tommy determine how much lemon he is intaking so that he won't end up on the streets drunk out of his mind.

Tommy puts the cross section of lemon on the plane and centers it at the origin point, (0, 0). He will give you Q queries and ask you for the area of the cross section of lemon between the intervals L and R. All of the lemons Tommy has can be represented by the equation \left|\frac{x}{a}\right|^3 + \left|\frac{y}{b}\right| = 1, and Tommy will provide you a, b, L and R for each query.

Constraints

1 \le Q \le 100

-300 \le a, b, L, R \le 300

L \le R

Input Specification

The first line is a positive integer Q, denoting the number of queries.

The next Q lines will each contain four space-separated integers, a, b, L and R.

Output Specification

For each query, output on a new line the area of the lemon in the given interval.

Note: Your output will be accepted if it is within 10^{-3} of the expected output.

Sample Input

4
1 1 -2 2
1 1 -1 0
2 1 -1 0
1 1 -5 -4

Sample Output

3.000
1.500
1.938
0.000

Comments

There are no comments at the moment.