Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

E. Iron Man

time limit per test

5 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputTony Stark is playing a game with his suits (they have auto-pilot now). He lives in Malibu. Malibu has *n* junctions numbered from 1 to *n*, connected with *n* - 1 roads. One can get from a junction to any other junction using these roads (graph of Malibu forms a tree).

Tony has *m* suits. There's a special plan for each suit. The *i*-th suit will appear at the moment of time *t*_{i} in the junction *v*_{i}, and will move to junction *u*_{i} using the shortest path between *v*_{i} and *u*_{i} with the speed *c*_{i} roads per second (passing a junctions takes no time), and vanishing immediately when arriving at *u*_{i} (if it reaches *u*_{i} in time *q*, it's available there at moment *q*, but not in further moments). Also, suits move continuously (for example if *v*_{i} ≠ *u*_{i}, at time it's in the middle of a road. Please note that if *v*_{i} = *u*_{i} it means the suit will be at junction number *v*_{i} only at moment *t*_{i} and then it vanishes.

An explosion happens if at any moment of time two suits share the same exact location (it may be in a junction or somewhere on a road; while appearing, vanishing or moving).

Your task is to tell Tony the moment of the the first explosion (if there will be any).

Input

The first line of the input contains two integers *n* and *m* (1 ≤ *n*, *m* ≤ 100 000) — the number of junctions and the number of suits respectively.

The next *n* - 1 lines contain the roads descriptions. Each line contains two integers *a*_{i} and *b*_{i} — endpoints of the *i*-th road (1 ≤ *a*_{i}, *b*_{i} ≤ *n*, *a*_{i} ≠ *b*_{i}).

The next *m* lines contain the suit descriptions. The *i*-th of them contains four integers *t*_{i}, *c*_{i}, *v*_{i} and *u*_{i} (0 ≤ *t*_{i} ≤ 10 000, 1 ≤ *c*_{i} ≤ 10 000, 1 ≤ *v*_{i}, *u*_{i} ≤ *n*), meaning the *i*-th suit will appear at moment of time *t*_{i} at the junction *v*_{i} and will move to the junction *u*_{i} with a speed *c*_{i} roads per second.

Output

If there would be no explosions at all, print -1 in the first and only line of output.

Otherwise print the moment of the first explosion.

Your answer will be considered correct if its relative or absolute error doesn't exceed 10^{ - 6}.

Examples

Input

6 4

2 5

6 5

3 6

4 6

4 1

27 6 1 3

9 5 1 6

27 4 3 4

11 29 2 6

Output

27.3

Input

6 4

3 1

4 5

6 4

6 1

2 6

16 4 4 5

13 20 6 2

3 16 4 5

28 5 3 5

Output

-1

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Sep/25/2018 05:16:06 (d3).

Desktop version, switch to mobile version.

User lists

Name |
---|