
127  ZOJ Monthly, June 2013  E
There is a magnet board on the wall, and you can throw magnet darts towards it. When a magnet dart hit a point (x, y), because of the magnetism, it will be pulled to the nearest integer point (x', y'), and you can get a score of Ax' + By'. To make the game more interesting, only the integer points in the given Npolygon (or on the border) could get score. And we assume all the throw must hit a point which is in a rectangle area, and the polygon is also in the rectangle. Your task is to calculate the average expectation of score per throw. InputThere are multiple test cases. For each test case: The first line contains four real numbers P_{0}, Q_{0}, P_{1}, Q_{1} (0≤P_{0}<P_{1}≤500, 0≤Q_{0}<Q_{1}≤500), represents the lower left point and the upper right point of the rectangle area, all the throw must hit a point in it. The second line contains three integers N (3≤N≤20), A, B (100≤A, B≤100). The meaning of them is in the description above. Next N lines, each line contains two intergers X_{i}, Y_{i}, represents the i^{th} vertex of the polygon by clockwise order, we promise each vertex is in the rectangle area. There is a blank line between every two cases. OutputOne line for each case. The the average expectation of score per throw with three decimal places. Sample Input0 0 4 3 3 1 1 2 3 4 2 3 0 Sample Output1.333 HintA throw hit a point which is outside the polygon may be pulled in it and get score. Author: LI, Huang 