|Online MIPT programming contest||РУССКИЙ|
Time limit = 3 second(s)There is an area bounded by a fence on some flat field. The fence has the height h and in the plane projection it has a form of a closed polygonal line (without self-intersections), which is specified by Cartesian coordinates (Xi, Yi) of its N vertices. At the point with coordinates (0, 0) a lamp stands on the field. The lamp may be located either outside or inside the fence, but not on its side as it is shown in the following sample pictures (parts shown in a thin line are not illuminated by the lamp):
where k is a known constant value not depending on the point in question, r is the distance between this point and the lamp in the plane projection. The illumination of an infinitesimal narrow vertical board with the width dl and the height h is:
Input The first line of the input file contains the numbers k, h and N, separated by spaces. k and h are real constants. N (3<=N<=100) is the number of vertices of the fence. Then N lines follow, every line contains two real numbers Xi and Yi, separated by a space.
Output Write to the output file the total illumination of the fence rounded to the second digit after the decimal point.
0.5 1.7 3 1.0 3.0 2.0 -1.0 -4.0 -1.0
1.5 10.0 4 0.0 -3.0 3.5 2.0 0.0 4.0 1.0 0.0
NEERC 1998 (http://neerc.ifmo.ru)
© acm.mipt DevGroup
The page was generated in 170ms