409633: GYM103648 J Birding In The Rain

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

J. Birding In The Raintime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

You are a bird in Seattle. As a result, you have been caught out in the rain. You need to travel a certain distance at a certain velocity. What is the amount of rain that hits your body?

If you were a normal bird like a Bali Bird of Paradise or a Long Wattled Umbrellabird, this might be very hard to calculate. Lucky for you, you are one of those exotic birds that are shaped like a rectangular prism, and you fly so that one of your faces is parallel to the ground.

Also, as is well known, Seattle rain is very predictable in many ways. In particular, you can model the rain as a uniform mist of density $$$\rho$$$ such that at any point in time, a chunk of space with volume $$$V$$$ will contain $$$\rho V$$$ rain.

To express the velocities of the rain and yourself, we can set up a rectangular coordinate system, so that your body is axis-aligned. Negative $$$z$$$ denotes the direction of gravity (that is, the direction things fall). The rain falls at a constant velocity, having reached terminal velocity, and has components $$$r_x, r_y, r_z$$$. You yourself are moving at velocity specified by components $$$v_x, v_y, v_z$$$. It is guaranteed that your speed is nonzero. Your body, being a rectangular prism, has lengths $$$x, y, z$$$ in the $$$x, y, z$$$ directions, respectively.

Input

The first line contains the two values, $$$1 \le \rho \le 10^6$$$ and $$$1 \le d \le 10^6$$$, the density of the rain and the distance needing to be traveled, space-separated.

The second line contains three numbers $$$-10^6 \le r_x, r_y, r_z \le 10^6$$$, the velocity components of the rain, space-separated.

The third line contains three numbers $$$-10^6 \le v_x, v_y, v_z \le 10^6$$$, the velocity components of yourself, space-separated. It is guaranteed that at least one of these values is nonzero.

The fourth and last line contains three numbers $$$1 \le x, y, z \le 10^6$$$, the lengths of your body along the $$$x, y, z$$$ axes respectively, space-separated.

Note that any of these values can be general real numbers, not just integers.

Output

A single number, equal to the quantity of rain that hits your rectangular bird body, up to an error of $$$10^{-6}$$$.

ExamplesInput
1 2
0 0 -1
0 0 1
1 1 1
Output
4
Input
4 3
1 1 1
2 1 2
2 1 1
Output
12

加入题单

算法标签: