QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100

#13220. Meteorology

Statistics

zzq is writing a renderer and has set up the following scene: there is a point light source at $(x_{1}, y_{1}, z_{1})$, a sphere with radius $r$ at $(x_{2}, y_{2}, z_{2})$, and a plane described by $a x+b y+c z+d=0$. It is guaranteed that the sphere, the point light source, and the plane do not intersect each other (the intersection set is empty).

To verify if the renderer is correct, he needs to calculate the area of the shadow formed on the plane by the sphere being illuminated by the point light source. zzq guarantees that this value is greater than 0 and finite. Your output must have an absolute or relative error no greater than $10^{-6}$ compared to the standard output.

Input

The first line contains a positive integer $T$, representing the number of test cases. The next $T$ lines each contain integers $x_{1}, y_{1}, z_{1}, x_{2}, y_{2}, z_{2}, r, a, b, c, d$ separated by spaces.

Output

Output $T$ lines, each containing a decimal number representing the shadow area.

Examples

Input 1

4
0 0 5 0 0 2 1 0 0 1 1
2 3 6 0 0 2 2 1 1 10 30
8 7 6 5 4 3 2 1 0 1 2
9 9 9 5 5 5 4 3 2 1 0

Output 1

14.1371669412
88.0769231962
147.2623403467
469.7668717193

For the first test case, it can be proven that the shadow area is $4.5 \pi$.

For the second test case, the rendered image is as follows. The goal is to find the area of the black shadow.

Note

$\left|x_{1}\right|,\left|y_{1}\right|,\left|z_{1}\right|,\left|x_{2}\right|,\left|y_{2}\right|,\left|z_{2}\right|,|a|,|b|,|c|,|d| \leq 10^{4}, 1 \leq r \leq 10^{4}, 1 \leq T \leq 30$.

  • Subtask 1 (30pts): $x_{1}=y_{1}=x_{2}=y_{2}=0, a=b=d=0, c=1$.
  • Subtask 2 (30pts): $x_{1}=x_{2}=0, a=b=d=0, c=1$.
  • Subtask 3 (20pts): $a=b=d=0, c=1$.
  • Subtask 4 (20pts): No special restrictions.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.