eolymp
bolt
Try our new interface for solving problems
Problems

Flat Earth

Flat Earth

The education system has let you down once again - your proposal to include the Flat Earth model into the high school program has been rejected for the sixth time in a row. The corrupt Round-Earth scientists refuse to listen to your arguments, and ignore the piles of data that support your claims.

It is time to settle this conflict once and for all. You have travelled all around the globe, and met with top Flat Earth scientists. Together, you devised a brilliant plan.

For the sake of contradiction, suppose that Earth is a sphere in the three-dimensional space. Then, assuming the sky is an infinite plane in the space, such an Earth would clearly cast a shadow on it! This shadow would be an orthogonal projection of Earth onto the sky. Since in reality there is no visible shadow on the sky, we reach a contradiction.

All that is left is to perform the calculations. Given the centre and radius of Earth, as well as the equation of the sky-plane in the form ax + by + cz + d = 0, determine the area of an orthogonal projection of Earth onto the sky. Note that in some of your experiments Earth may intersect the sky - you wouldn't like to introduce too many unnecessary assumptions, would you?

Input

The first line contains the number of test cases z (1z10). The descriptions of the test cases follow.

Every test case is described with a line containing eight integers x, y, z, r, a, b, c, d. They denote the coordinates of Earth's centre, it's radius, and the sky's equation, respectively. All numbers are between 1 and 1000 inclusive.

Output

For each test case output one number: the area of the projection with at least 6 decimal digits.

Time limit 1 second
Memory limit 128 MiB
Input example #1
1
2 3 5 7 1 2 4 8
Output example #1
153.938040026
Source 2018 Petrozavodsk, Winter, Jagiellonian U, January 30, Problem F