This page is still under construction.

Parts of this page are still being built. What you see may change.

Flat Earth

Time limit2sMemory limit512 MB

Summary
Given a sphere and a plane, compute the area of the sphere's orthogonal projection onto the plane.
Level

Medium6 of 10

Topics
Geometry, Math, Implementation, Brute force
Solved
No attempts yet

Problem

The education system has let you down once again. Your proposal to include the Flat Earth model in the high school curriculum 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 traveled 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 three-dimensional space. Then, assuming the sky is an infinite plane in that 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 center and radius of Earth, along with the equation of the sky plane in the form ax+by+cz+d=0ax + 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 would not want to introduce too many unnecessary assumptions, would you?

Input

The first line of input contains the number of test cases zz (1≤z≤101 \leq z \leq 10). The descriptions of the test cases follow.

Every test case is described by a line containing eight integers xx, yy, zz, rr, aa, bb, cc, dd. They denote the coordinates of Earth's center, its 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. Your answer will be considered correct if the absolute or relative error does not exceed 10−610^{-6}.

Examples1

  1. Example 1

    Input
    1
    2 3 5 7 1 2 4 8
    
    Expected output
    153.938040026