This page is still under construction.

Parts of this page are still being built. What you see may change.

Damage Assessment

Time limit1sMemory limit256 MB

Summary
Compute the remaining gasoline volume in a tilted cylindrical tank with spherical caps from the tilt and liquid level.
Level

Hard8 of 10

Topics
Geometry, Math
Solved
No attempts yet

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 dd and length ll, and each cap has radius rr (2r≥d2r \ge d). 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 tt, 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 (0≤t≤l0 \le t \le l). The gasoline level is measured as hh, 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 0≤h≤t+d1−(t/l)20 \le h \le t + d\sqrt{1 - (t/l)^2}.

Compute the volume of gasoline left in the tank car.

Input

The first line contains five integers dd, ll, rr, tt, hh 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 = 10−310^{-3} meters). They satisfy d,l≥100d, l \ge 100, d,l,r≤10000d, l, r \le 10000 and every condition stated above.

Output

Print the volume of the gasoline in liters with exactly two digits after the decimal point (1 liter = 10−310^{-3} cubic meters = 10610^6 cubic millimeters). In every input the exact volume is more than 0.0005 liters away from a rounding boundary of the second decimal digit.

Examples2

  1. Example 1

    Input
    3000 6000 1600 0 3000
    
    Expected output
    50974.56
    
  2. Example 2

    Input
    3000 6000 1600 3441 4228
    
    Expected output
    40728.90