Repairing
In the International City of Pipe Construction, it is planned to repair the water pipe at a certain point in the water pipe network. The network consists of water pipe segments, stop valves and source point. A water pipe is represented by a segment on a 2D-plane and intersected pair of water pipe segments are connected at the intersection point. A stop valve, which prevents from water flowing into the repairing point while repairing, is represented by a point on some water pipe segment. In the network, just one source point exists and water is supplied to the network from this point.
Of course, while repairing, we have to stop water supply in some areas, but, in order to reduce the risk of riots, the length of water pipes stopping water supply must be minimized. What you have to do is to write a program to minimize the length of water pipes needed to stop water supply when the coordinates of end points of water pipe segments, stop valves, source point and repairing point are given.
Input
A data set has the following format:
N M
x_s1 y_s1 x_d1 y_d1
...
x_sN y_sN x_dN y_dN
x_v1 y_v1
...
x_vM y_vM
x_b y_b
x_c y_c
The first line of the input contains two integers, N (1 ≤ N ≤ 300) and M (0 ≤ M ≤ 1000) that indicate the number of water pipe segments and stop valves. The following N lines describe the end points of water pipe segments. The i-th line contains four integers, x_si, y_si, x_di and y_di that indicate the pair of coordinates of end points of i-th water pipe segment. The following M lines describe the points of stop valves. The i-th line contains two integers, x_vi and y_vi that indicate the coordinate of end points of i-th stop valve. The following line contains two integers, x_b and y_b that indicate the coordinate of the source point. The last line contains two integers, x_c and y_c that indicate the coordinate of the repairing point.
You may assume that any absolute values of coordinate integers are less than 1000 (inclusive.) You may also assume each of the stop valves, the source point and the repairing point is always on one of water pipe segments and that that each pair among the stop valves, the source point and the repairing point are different. And, there is not more than one intersection between each pair of water pipe segments. Finally, the water pipe network is connected, that is, all the water pipes are received water supply initially.
Output
Print the minimal length of water pipes needed to stop water supply in a line. The absolute or relative error should be less than or 10^{−6}. When you cannot stop water supply to the repairing point even though you close all stop valves, print "-1" in a line.