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;
const int N = 150005;
const double inf = 1e9, eps = 1e-7;
int n, m, cc, vis[N], hd[N], nxt[N << 1], to[N << 1], t[N], d[N], fa[N], sz[N],
    tp[N], hs[N];
double T, ans, c[N], ed[N];
inline double tim(int x, int y, double v) { return (double)(d[x] - d[y]) / v; }
inline void add(int x, int y) {
  nxt[cc] = hd[x];
  to[cc] = y;
  hd[x] = cc++;
}
void pre(int x) {
  sz[x] = 1;
  for (int i = hd[x], y; ~i; i = nxt[i])
    if ((y = to[i]) != fa[x]) {
      fa[y] = x;
      d[y] = d[x] + 1;
      pre(y);
      sz[x] += sz[y];
      hs[x] = sz[y] > sz[hs[x]] ? y : hs[x];
    }
}
void dfs(int x, int top) {
  tp[x] = top;
  if (hs[x]) dfs(hs[x], top);
  for (int i = hd[x], y; ~i; i = nxt[i])
    if ((y = to[i]) != fa[x] && y != hs[x]) dfs(y, y);
}
struct st {
  int x;
  double y;
  int k;
  double C;
  int f;
} s[N];
inline double ps(st a) { return 1.0 * d[a.x] + 1.0 * (T - a.y) * c[a.k]; }
inline bool operator<(const st& a, const st& b) { return ps(a) < ps(b); }
inline bool cmp(st a, st b) {
  return fabs(a.y - b.y) < eps ? a.f > b.f : a.y < b.y;
}
vector<st> f[N];
multiset<st> S;
multiset<st>::iterator t1, t2;
inline void gt(st x, st y) {
  double p = (ps(y) - ps(x)) / (c[x.k] - c[y.k]);
  if (fabs(ps(y) - ps(x)) < eps) p = 0;
  if (p + eps > 0 && p + T < min(ed[x.k], ed[y.k]) + eps) ans = min(ans, p + T);
}
inline void sol(int x) {
  vis[x] = 1;
  S.clear();
  sort(f[x].begin(), f[x].end(), cmp);
  for (int i = 0; i < f[x].size(); i++)
    if (f[x][i].f)
      s[f[x][i].k] = f[x][i];
    else
      ed[f[x][i].k] = f[x][i].y;
  for (int i = 0; i < f[x].size(); i++) {
    st t = f[x][i];
    T = t.y;
    if (T >= ans) break;
    if (t.f) {
      t1 = S.insert(t);
      c[t.k] = t.C;
      if (t1 != S.begin()) t1--, gt(t, (*t1)), t1++;
      t1++;
      if (t1 != S.end()) gt(t, (*t1));
    } else {
      t1 = S.find(s[t.k]);
      if (t1 != S.begin()) {
        t2 = t1;
        t2--;
        t1++;
        if (t1 != S.end() && t1 != t2) gt((*t2), (*t1));
        t1--;
      }
      if (t1 != S.end()) S.erase(t1);
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  memset(hd, -1, sizeof(hd));
  for (int i = 1, x, y; i < n; i++) scanf("%d%d", &x, &y), add(x, y), add(y, x);
  pre(1);
  dfs(1, 1);
  for (int i = 1, u, v; i <= m; i++) {
    scanf("%d%lf%d%d", &t[i], &c[i], &u, &v);
    int x = u, y = v, lca;
    for (; tp[x] != tp[y]; x = fa[tp[x]])
      if (d[tp[x]] < d[tp[y]]) swap(x, y);
    if (d[x] > d[y]) swap(x, y);
    lca = x;
    x = u;
    y = v;
    double tt = t[i] + tim(u, lca, c[i]);
    int ff = 1;
    for (; tp[x] != tp[y]; x = fa[tp[x]]) {
      if (d[tp[x]] < d[tp[y]]) swap(x, y), ff ^= 1;
      if (ff) {
        f[tp[x]].push_back((st){x, t[i] + tim(u, x, c[i]), i, -c[i], 1});
        f[tp[x]].push_back(
            (st){fa[tp[x]], t[i] + tim(u, fa[tp[x]], c[i]), i, -c[i], 0});
      } else {
        f[tp[x]].push_back(
            (st){fa[tp[x]], tt + tim(fa[tp[x]], lca, c[i]), i, c[i], 1});
        f[tp[x]].push_back((st){x, tt + tim(x, lca, c[i]), i, c[i], 0});
      }
    }
    if (d[x] < d[y]) swap(x, y), ff ^= 1;
    if (ff) {
      f[tp[x]].push_back((st){x, t[i] + tim(u, x, c[i]), i, -c[i], 1});
      f[tp[x]].push_back((st){y, tt, i, -c[i], 0});
    } else {
      f[tp[x]].push_back((st){y, tt, i, c[i], 1});
      f[tp[x]].push_back((st){x, tt + tim(x, y, c[i]), i, c[i], 0});
    }
  }
  ans = inf;
  for (int i = 1; i <= n; i++)
    if (!vis[tp[i]]) sol(tp[i]);
  if (fabs(ans - inf) < 1)
    puts("-1");
  else
    printf("%.6lf\n", ans);
  return 0;
}