A flat field has a region enclosed by a fence of height h. Viewed from above (in plan projection), the fence forms a simple closed polygonal line (with no self-intersections), given by the Cartesian coordinates (Xi,Yi) of its N vertices, listed in order around the boundary.
A point lamp stands on the field at coordinates (0,0). The lamp may lie either inside or outside the fenced region, but it never lies exactly on a side of the fence.
The fence is perfectly black: it neither reflects, diffuses, nor transmits light, so it also casts shadows. A board of the fence is lit only if the straight ray from the lamp reaches it without being blocked by another part of the fence.
The intensity of light reaching an illuminated point of the fence is
I0=rk
where k is a known constant (the same for every point) and r is the plan-projection distance from that point to the lamp.
Consider an infinitesimally narrow vertical board of width dl and height h. Its illumination is
dI=I0⋅∣cosα∣⋅dl⋅h
where I0 is the light intensity on that board and α is the angle (in plan projection) between the normal to the fence side at that point and the direction to the lamp.
Write a program that computes the total illumination of the fence, defined as the sum of the illuminations of all its lit boards.
The first line contains k, h, and N, separated by spaces. k and h are real constants, and N (3≤N≤100) is the number of fence vertices. Each of the next N lines contains two real numbers Xi and Yi separated by a space -- the coordinates of one vertex, given in order around the fence.
Print the total illumination of the fence, rounded to two digits after the decimal point.