Not long ago, at the world's finals in Tokyo, Bill Poucher asked Dean of the
Department of Mathematics and Mechanics of the Ural State University:
“Then won't get tired, the pyramid is very light,” Dean answered.
“It isn't light, it has some liquid inside,” Denis, who was translating, retorted.
“And what is the volume of your pyramid?” asked Poucher.
Today you will answer Poucher's question.
Note that the pyramid is in fact a pen holder with a cylindrical hole going through
it. If the pyramid is put on its base, then the axis of the hole is strictly
The first line contains numbers H and W, which are the height of the pyramid
and the length of a side of the base (as you remember, Dean's pyramid is a
regular quadrangular pyramid). The second line contains numbers X and Y,
which are the coordinates of the center of the hole (we assume that the axes
are parallel to the sides of the base and the origin is at the center of the
base). The third line contains the radius of the hole R.
It is known that the hole does not intersect the edges of the pyramid
(0 < H, W < 104,
|X| < W/2,
|Y| < W/2,
0 < R < W/2).
Output the volume of the pyramid accurate to 10–3.
Problem Author: Evgeniy Krokhalev
Problem Source: The 11th Urals Collegiate Programing Championship, Ekaterinburg, April 21, 2007