Problem: Tony 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 ti in the junction vi, and will move to junction ui using the shortest path between vi and ui with the speed ci roads per second (passing a junctions takes no time), and vanishing immediately when arriving at ui (if it reaches ui in time q, it's available there at moment q, but not in further moments). Also, suits move continuously (for example if vi ≠ ui, at time <image> it's in the middle of a road. Please note that if vi = ui it means the suit will be at junction number vi only at moment ti 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 ai and bi — endpoints of the i-th road (1 ≤ ai, bi ≤ n, ai ≠ bi).

The next m lines contain the suit descriptions. The i-th of them contains four integers ti, ci, vi and ui (0 ≤ ti ≤ 10 000, 1 ≤ ci ≤ 10 000, 1 ≤ vi, ui ≤ n), meaning the i-th suit will appear at moment of time ti at the junction vi and will move to the junction ui with a speed ci 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

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int A[100001], B[3300033], D[3300033], O[100001], P[100001], Q, a[100001],
    b[200002], c[200002], d[100001], e[3300033], f[100001], g[100001],
    h[100001], l[3300033][2], m, n, r, s[3300033], t;
double C[3300033], E[3300033], F[3300033], x;
inline double _k(int u, int v) {
  if (D[u] == D[v])
    return C[v] - C[u] < 1e-10 ? max(E[u], E[v]) : x;
  else
    return max(E[u], E[v]) <= (C[v] - C[u]) / (D[u] - D[v]) + 1e-10 &&
                   (C[v] - C[u]) / (D[u] - D[v]) <= min(F[u], F[v]) + 1e-10
               ? (C[v] - C[u]) / (D[u] - D[v])
               : x;
}
inline void _j(int u) { s[u] = s[l[u][0]] + s[l[u][1]] + 1; }
inline int _i(int u, int v) {
  while (true)
    if (v == s[l[u][0]] + 1)
      return u;
    else if (v <= s[l[u][0]])
      u = l[u][0];
    else
      v -= s[l[u][0]] + 1, u = l[u][1];
}
inline void _h(int& u, int v) {
  int w = l[u][v];
  l[u][v] = l[w][v ^ 1], _j(l[w][v ^ 1] = u), u = w;
}
int _g(int& u, int v) {
  if (u != v)
    return s[u]--, C[u] + D[u] * F[v] < C[v] + D[v] * F[v]
                       ? s[l[u][0]] + 1 + _g(l[u][1], v)
                       : _g(l[u][0], v);
  else if (!l[u][0] || !l[u][1])
    return l[u][1] ? u = l[u][1], 0 : s[u = l[u][0]];
  else if (e[l[u][0]] < e[l[u][1]])
    _h(u, 0), s[u] = s[l[u][0]] + s[l[u][1]], _g(l[u][0], v);
  else
    return _h(u, 1), s[u] = s[l[u][0]] + s[l[u][1]],
                     s[l[u][0]] + 1 + _g(l[u][1], v);
}
int _f(int& u, int v) {
  int S;
  if (!u)
    e[u = v] = rand(), S = 1;
  else if (C[v] + D[v] * E[v] < C[u] + D[u] * E[v])
    S = _f(l[u][0], v), e[l[u][0]] < e[u] ? _h(u, 0), 0 : 0;
  else
    S = s[l[u][0]] + 1 + _f(l[u][1], v), e[l[u][1]] < e[u] ? _h(u, 1), 0 : 0;
  return _j(u), S;
}
inline bool _e(int u, int v) { return F[u] < F[v]; }
inline bool _d(int u, int v) { return E[u] < E[v]; }
inline void _c(int u, int v, int w, double y) {
  int i = u, j = v;
  double z = d[u] + d[v];
  while (h[i] != h[j]) d[h[i]] < d[h[j]] ? j = f[h[j]] : i = f[h[i]];
  z -= d[i] < d[j] ? d[j = i] << 1 : d[i = j] << 1, z = z / w + y;
  while (h[u] != h[i])
    B[++t] = A[h[u]], C[A[h[u]] = t] = d[u] + w * y, D[t] = -w, E[t] = y,
    F[t] = y += (double)(d[u] - d[f[h[u]]]) / w, u = f[h[u]];
  while (h[v] != h[j])
    B[++t] = A[h[v]], C[A[h[v]] = t] = d[v] - w * z, D[t] = w, F[t] = z,
    E[t] = z -= (double)(d[v] - d[f[h[v]]]) / w, v = f[h[v]];
  if (d[u] < d[v])
    B[++t] = A[h[v]], C[A[h[v]] = t] = d[v] - w * z, D[t] = w, F[t] = z,
    E[t] = z -= (double)(d[v] - d[j]) / w;
  else
    B[++t] = A[h[u]], C[A[h[u]] = t] = d[u] + w * y, D[t] = -w, E[t] = y,
    F[t] = y += (double)(d[u] - d[i]) / w;
}
void _b(int u) {
  if (s[u] = 0, g[u]) h[g[u]] = h[u], _b(g[u]);
  for (int& i = a[u]; i; i = b[i])
    if (c[i] != f[u] && c[i] != g[u]) _b(h[c[i]] = c[i]);
}
void _a(int u) {
  s[u] = 1, d[u] = d[f[u]] + 1;
  for (int i = a[u]; i; i = b[i])
    if (c[i] != f[u])
      f[c[i]] = u, _a(c[i]), s[u] += s[c[i]],
      g[u] = s[g[u]] < s[c[i]] ? c[i] : g[u];
}
int main() {
  scanf("%d%d", &n, &m), srand(time(0)), x = 1e9 + 7;
  for (int i = 1, u, v; i < n; i++)
    scanf("%d%d", &u, &v), b[++t] = a[u], c[a[u] = t] = v, b[++t] = a[v],
                           c[a[v] = t] = u;
  _a(1), _b(h[1] = 1), t = 0;
  for (int u, v, w, y; m; m--)
    scanf("%d%d%d%d", &y, &w, &u, &v), _c(u, v, w, y);
  for (int i = 1; i <= n; i++)
    if (A[i]) {
      for (Q = r = 0; A[i];) O[++Q] = A[i], P[Q] = A[i], A[i] = B[A[i]];
      sort(O + 1, O + Q + 1, _d), sort(P + 1, P + Q + 1, _e);
      for (int j = 1, k = 1, u, v = 0;;)
        if (j <= Q && (Q < k || E[O[j]] - F[P[k]] < 1e-10) && E[O[j]] < x)
          u = _f(r, O[j]), u != 1 ? x = min(x, _k(_i(r, u - 1), O[j])) : 0.0,
          u != ++v ? x = min(x, _k(O[j], _i(r, u + 1))) : 0.0, j++;
        else if (k <= Q && (Q < j || 1e-10 < E[O[j]] - F[P[k]]) && F[P[k]] < x)
          u = _g(r, P[k]),
          u != --v&& u ? x = min(x, _k(_i(r, u), _i(r, u + 1))) : 0.0, k++;
        else
          break;
    }
  return 0 & (1e9 < x ? puts("-1") : printf("%.30lf\n", x));
}