Damage Assessment
Time limit1sMemory limit256 MB
Compute the remaining gasoline volume in a tilted cylindrical tank with spherical caps from the tilt and liquid level.
Problem
A rail tank car that carries gasoline has the shape of a cylinder with a spherical cap on each end. The cylinder has diameter and length , and each cap has radius (). A derailment left the car lying tilted on the ground, and part of the gasoline flowed out. The damage assessment needs the amount that is left.
The position of the car is measured as the tilt , the height difference between the lowest point of the cylinder at its left end and the lowest point of the cylinder at its right end (). The gasoline level is measured as , the height difference between the lowest point of the cylinder part and the surface of the gasoline. The surface is horizontal and always crosses the cylinder part, so .
Compute the volume of gasoline left in the tank car.
Input
The first line contains five integers , , , , separated by spaces: the diameter and the length of the cylinder part, the radius of the spherical caps, the tilt measurement and the gasoline level measurement. All of them are in millimeters (1 millimeter = meters). They satisfy , and every condition stated above.
Output
Print the volume of the gasoline in liters with exactly two digits after the decimal point (1 liter = cubic meters = cubic millimeters). In every input the exact volume is more than 0.0005 liters away from a rounding boundary of the second decimal digit.