The input consists of multiple datasets. Each dataset is given in the following format.
L
Polygon1
Polygon2
L is a decimal fraction, which means the required distance of two polygons. L is greater than 0.1 and less than 50.0.
The format of each polygon is as follows.
n
x1 y1
x2 y2
...
xn yn
n is a positive integer, which represents the number of vertices of the polygon. n is greater than 2 and less than 15.
Remaining lines represent the vertices of the polygon. A vertex data line has a pair of nonnegative integers which represent the x- and y-coordinates of a vertex. x- and y-coordinates are separated by a single space, and y-coordinate is immediately followed by a newline. x and y are less than 500.
Edges of the polygon connect vertices given in two adjacent vertex data lines, and vertices given in the last and the first vertex data lines. You may assume that the vertices are given in the counterclockwise order, and the contours of polygons are simple, i.e. they do not cross nor touch themselves.
Also, you may assume that the result is not sensitive to errors. In concrete terms, for a given pair of polygons, the minimum width is a function of the given minimum distance l. Let us denote the function w(l). Then you can assume that |w(L±10
-7)-w(L)| < 10
-4.
The end of the input is indicated by a line that only contains a zero. It is not a part of a dataset.