eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Cocktail

Cocktail

\includegraphics{https://static.e-olymp.com/content/3a/3afb421fb5e86b6d97042b8994245f25cf2ead29.jpg} Cylindrical vessel of height \textbf{H} (\textbf{0} < \textbf{H} ≤ \textbf{10000}) and bottom radius \textbf{R} (\textbf{0} < \textbf{R} ≤ \textbf{10000}) stands on a horizontal surface. There are two liquids in the vessel. The liquids have different density and do not mix. \textbf{D_1} and \textbf{D_2} are densities of the first and the second liquids respectively, \textbf{0} < \textbf{D_2} < \textbf{D_1} ≤ \textbf{10000}. \textbf{h_1} and \textbf{h_2} are heights of layers of the first and the second liquids, \textbf{h_1}, \textbf{h_2} > \textbf{0}, \textbf{h_1 + h_2} ≤ \textbf{H}. There is a cube made of a solid material. The cube’s edge length is \textbf{n} (\textbf{0} < \textbf{n} ≤ \textbf{1.4*R}), the material’s density is \textbf{D} (\textbf{0} < \textbf{D} ≤ \textbf{10000}). The cube is put down into the vessel in such a way that one of its sides is horizontal. Pay attention that some amount of liquid may pour out of the vessel. As a result of the operation the cube floats in liquids or lie on the vessel bottom. You need to calculate the height of the vessel which is occupied by the liquids after the cube is put down into the vessel. You may neglect damping and some other physical effects, but you should take into account Archimedean Principle. \InputFile The only line of the file contains numbers \textbf{H}, \textbf{R}, \textbf{D_1}, \textbf{h_1}, \textbf{D_2}, \textbf{h_2}, \textbf{D} and \textbf{n} separated by spaces. All the numbers are real. Each of them does not contain more than three digits in its fractional part. \OutputFile Output data contain one real number -- the height you need to calculate. Absolute error must not exceed \textbf{10^\{-3\}}.
Ліміт часу 1 секунда
Ліміт використання пам'яті 128 MiB
Вхідні дані #1
50 5 2.5 10 1.5 10 1.5 3
Вихідні дані #1
20.343774677078493
Джерело ACM Programming Contest 2005, Minsk, October 2005