Railway is a broken line of N segments. The problem is to find such a position for the railway station
that the distance from it to the given point M is the minimal. Input
The input will consist of several input blocks. Each input block begins with two lines with coordinates Xm and Ym of the point M. In the third line there is N — the number of broken line segments. The next 2N + 2 lines contain the X and the Y coordinates of consecutive broken line corners.
The input is terminated by