
A cylindrical vessel of height H (0<H≤10000) and bottom radius R (0<R≤10000) stands on a horizontal surface. It holds two liquids that have different densities and do not mix. Let D1 and D2 be the densities of the first and second liquids, with 0<D2<D1≤10000, so the denser first liquid forms the lower layer and the second liquid rests on top. Let h1 and h2 be the heights of the two layers, with h1,h2>0 and h1+h2≤H.
A solid cube has edge length n (0<n≤1.4R) and is made of a material of density D (0<D≤10000). The cube is lowered into the vessel so that one of its faces stays horizontal. Some liquid may spill over the rim. When it comes to rest, the cube either floats in the liquids or lies on the bottom.
Using Archimedes' principle (and neglecting damping and other minor physical effects), compute the height of the liquid column in the vessel after the cube has been placed.
The single line contains the numbers H, R, D1, h1, D2, h2, D, and n, separated by spaces. All numbers are real and each has at most three digits after the decimal point.
Print one real number: the resulting liquid height, rounded to exactly three digits after the decimal point.