402063: GYM100637 I Scrooge.net
Description
In the Scrooge Village they have finally got Internet access. Well, sort of... Direct cable line was routed across the village and into the city nearby. The villagers were proud of the fact that the Internet was finally available in the village and decided to get connected. The provider made a decision to install only one connection gate but let the villagers choose the point of connection. Naturally, the scroogers wanted to have all k houses connected to the network and save as much as possible on the wiring. It was decided that the communication wires are to be stretched from each house to the connection point no matter how complicated the mounting was.
Knowing each house location it is required to find a point on the cable line, which makes the total distance to all the houses minimal.
InputFirst line contains two pairs of integers X1, Y1 ,X2 ,Y2 ( - 100 ≤ X1, Y1, X2, Y2 ≤ 100) — the Cartesian coordinates of two different points located on the cable line. Second line contains integer k (1 ≤ k ≤ 10 000) — the number of houses. Following k lines contain two integers each Xi, Yi ( - 10 000 ≤ Xi, Yi ≤ 10 000) — i-th house coordinates.
OutputWrite the total wire length needed and coordinates of the connection point. If there are several such points, output any. The answer is considered to be correct if absolute or relative error does not exceed 10 - 5.
ExamplesInput2 0 6 0Output
1
2 3
3.0000000000
2.0000000000 0.0000000000