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

Cocktail

Cocktail

prb6856 Цилиндрический сосуд высоты H (0 < H10000) радиуса R (0 < R10000) стоит на горизонтальной поверхности. В сосуде две жидкости. Жидкости имеют разную плотность и не смешиваются. d1 and d2 are densities of the first and the second liquids respectively (0 < d2 < d110000). h1 and h2 are heights of layers of the first and the second liquids (h1, h2 > 0, h1 + h2H). There is a cube made of a solid material. The cube's edge length is n (0 < n1.4 * R), the material's density is d (0 < d10000). 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.

Input

The only line contains numbers H, R, d1, h1, d2, h2, d and n. All the numbers are real. Each of them does not contain more than three digits in its fractional part.

Output

Print one real number - the height you need to calculate. Absolute error must not exceed 10-3.

Лимит времени 1 секунда
Лимит использования памяти 128 MiB
Входные данные #1
50 5 2.5 10 1.5 10 1.5 3
Выходные данные #1
20.343774677078493
Источник 2005 ACM, Minsk, October