![]() |
||||||||||
|
||||||||||
Death by Thousand CutsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 22 Accepted Submission(s): 13 Problem Description While Jonathan was doing his math homework, he found a multiple-choice question: Given a cuboid with each edge parallel to the coordinate axis, two vertexes of which are (0,0,0) and (a,b,c), and a plane Ax + By + Cz + D = 0 which intersects the cuboid. You are asked to calculate the number of edges of the cross section. Four options are provided: A. three, B. four, C. five and D. six. ![]() Unfortunately, the number D has been covered by black ink so Jonathan didn’t know what exactly it is. Therefore, D couldbe the anyreal number satisfyingthe plane intersectsthe cuboid in equal probability. Then Jonathan found some options had significantly greater probability to be the correct answer in some cases. For example, if the cuboid is (0,0,0),(1,1,1) and the plane is x+y+D = 0, then the option B has the 100% probability to be the right answer. Therefore, he wanted to know each option’s probability to be the correct answer in normal cases. As the problem is too hard for him, please help him to calculate the answer. We can prove that the probability of each option is a rational number. Let’s denote it by irreducible fraction Q/P, you are only to print the value Q$\times P^{-1}$ mod $10^9$ + 7. Here $P^{-1}$ is multiplicative inverse of P modulo $10^9$ + 7. Input The first line of the input gives the number of test cases, T (1 ≤ T ≤ $10^4$). T test cases follow. For each testcase, only one line contains 6 integers a,b,c,A,B,C (1 ≤ a,b,c ≤ $10^4$,0 ≤|A|,|B|,|C|≤ $10^4$, |A|+|B|+|C| > 0), representing the diagonal point (a,b,c) and the parameters of the plane equation. Output For each test case, print a line with four integers $P_1,P_2,P_3,P_4,$ representing the probability of options A, B, C and D respectively. Sample Input
Sample Output
Source | ||||||||||
|