Coffee Milk
Time limit3sMemory limit1024 MB
Given a tetrahedron with integer vertices and N scale factors K, count the lattice points on its surface and inside it for each K, modulo 1003003001.
- Level
Hard8 of 10
- Topics
- Math, Geometry, Number theory
- Solved
- No attempts yet
Problem
W Dairy sells a coffee milk in the shape of a triangular pyramid. The capacity of the coffee milk is the number of lattice points on the boundary of the space it occupies and inside that space.
To mark the 10th anniversary of the coffee milk, W Dairy plans to release a new product that is the original scaled by . The original is a triangular pyramid with vertices , , , and in three-dimensional space. The new product is a triangular pyramid whose vertices are , where is each vertex of the original multiplied by .
Given candidate values of , find the capacity of the new product for each candidate.
The answer can be very large, so print the capacity modulo .
Input
The first line contains the number of candidates for ().
The second line contains the integers , , and , the x, y, and z coordinates of , separated by spaces ().
The third line contains the integers , , and , the coordinates of , separated by spaces ().
The fourth line contains the integers , , and , the coordinates of , separated by spaces ().
The fifth line contains the integers , , and , the coordinates of , separated by spaces ().
The sixth line contains the candidate values , , , for , separated by spaces ().
The volume of the triangular pyramid is greater than .
Output
For each candidate , print the capacity of the new product modulo . Separate the answers with spaces.