The kingdoms of Nlogonia and Quadradonia fought a long and terrible war. Nobody remembers why it started, so historians call it the Almost Completely Meaningless (ACM) war. When the ACM war ended, the two kingdoms decided to strengthen their bonds and avoid more bloodshed, so they asked the International Consortium for the Prevention of Conflicts (ICPC) for advice. The ICPC recommended building exactly one new road between a city of Nlogonia and a city of Quadradonia, so that the two kingdoms can trade and exchange culture.
Nlogonia has N cities and Quadradonia has Q cities. The road system of a kingdom is a set of bidirectional roads, each joining two different cities of that kingdom, and from any city of a kingdom to any other city of the same kingdom there is exactly one path, that is, one sequence of consecutive roads. The size of such a road system is the largest number of roads you must take to travel between two of its cities.
The ICPC did not say which two cities the new road should join, so the citizens worry that the combined road system becomes too large. To rule out a second ACM war you have to show them otherwise. Every road that could be built between the two kingdoms is equally likely to be the one that gets built. Compute the expected size of the resulting road system.
The first line contains two integers N and Q, the number of cities in each of the two kingdoms (1≤N,Q≤4×104). Cities of Nlogonia carry distinct integers from 1 to N, and cities of Quadradonia carry distinct integers from 1 to Q.
Each of the next N−1 lines describes one road of Nlogonia with two distinct integers A and B, meaning that the road joins city A and city B (1≤A,B≤N).
Each of the following Q−1 lines describes one road of Quadradonia in the same format, where the distinct integers C and D mean that the road joins city C and city D (1≤C,D≤Q).
In each kingdom there is exactly one path between every pair of cities.
Print one line with the expected size of the combined road system, given that every possible road joining the two kingdoms is equally likely.
Print exactly three digits after the decimal point and round the digits below that to the nearest value, rounding a value that falls exactly halfway upward. Write all three decimal digits even when the expected value is an integer.