acm International Collegiate Programming Contest

Links

A B C D E F G H

Problem H

Idealistic Canister

The Ideally Compact Packaging Canisters (ICPC) corporation is a package manufacturer specialized in canisters (cylindrical containers), designing and manufacturing canisters satisfying clients' demands.

The corporation has taken an order of a canister to pack two different products together. Both products have shapes of convex polygonal prisms with the same height. The inside of the canister should be precisely a cylinder whose height is equal to the height of the products.

Products must be placed vertically in the canister, that is, the bottoms of the products must meet the inner bottom of the canister. Products can be placed at an arbitrary position and with an arbitrary direction in the canister, but they should not be laid upside-down nor stacked one on the other. Products and the inner surface of the canister may touch one another.

The customer requests to make the canister as small as possible. Your task is to find the smallest possible diameter of the canister bottom that can contain the two products.

Figure H-1 Example of two products packed in the minimum-sized canister.

Input

The input consists of at most 50 datasets, each in the following format.

n
xa,1 ya,1
...
xa,n ya,n
m
xb,1 yb,1
...
xb,m yb,m

n (3 ≤ n ≤ 40) is the number of vertices of the bottom polygon of one of the products. The following n lines have two integers each, which are the x- and y-coordinates of the vertices of the bottom polygon. They are between −1000 and 1000, inclusive. The vertices are listed in a counter-clockwise order. The bottom polygon is guaranteed to be convex.

Then comes the description of the bottom polygon of the other product in exactly the same manner.

The end of the input is indicated by a line containing a zero.

Output

For each dataset, output the smallest possible diameter of the bottom circle of the canister that accommodates the two products together. The output must not contain an error greater than 10−6.

Sample Input

3
8 0
7 7
0 6
4
0 0
5 0
5 5
0 5
3
0 0
2 2
0 2
3
3 1
5 1
5 3
5
0 0
3 0
3 1
1 3
0 3
5
0 0
3 0
3 1
1 3
0 3
9
0 0
9 4
13 13
9 22
6 24
-6 24
-9 22
-13 13
-9 4
4
1 0
0 5
-1 0
0 -5
0

Output for the Sample Input

10.625000000000
2.828427124746
5.656854249492
26.000000000000
(End of Problem H) A B C D E F G H