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 double eps = 1e-8;
int A, B, rt, n, m, son[200005], h[200005], fa[200005], top[200005], s[200005];
double t, ans;
vector<int> a[200005];
vector<double> b[200005];
struct O {
  double l, r;
};
vector<O> T[200005];
struct P {
  double t;
  int f;
};
vector<P> w;
int lc[200005], rc[200005], ll[200005], rr[200005];
void up(int u) {
  ll[u] = lc[u] ? ll[lc[u]] : u;
  rr[u] = rc[u] ? rr[rc[u]] : u;
  s[u] = s[lc[u]] + s[rc[u]] + 1;
}
void split(int u, int k, int &l, int &r) {
  if (!u) {
    l = 0, r = 0;
    return;
  }
  if (a[m][u - 1] * t + b[m][u - 1] < a[m][k] * t + b[m][k] + eps)
    l = u, split(rc[u], k, rc[u], r);
  else
    r = u, split(lc[u], k, l, lc[u]);
  up(u);
}
int SPLIT(int u) {
  if (!rc[u]) return lc[u];
  rc[u] = SPLIT(rc[u]);
  up(u);
  return u;
}
int merg(int l, int r) {
  if (!l || !r) return l + r;
  if (1ll * (s[l] + s[r]) * rand() < 1ll * s[l] * RAND_MAX) {
    rc[l] = merg(rc[l], r);
    up(l);
    return l;
  } else {
    lc[r] = merg(l, lc[r]);
    up(r);
    return r;
  }
}
void dfs(int x, int y) {
  s[x] = 1;
  h[x] = h[y] + 1;
  fa[x] = y;
  for (int i = 0; i < (int)a[x].size(); ++i)
    if (a[x][i] != y) {
      dfs(a[x][i], x);
      s[x] += s[a[x][i]];
      if (s[a[x][i]] > s[son[x]]) son[x] = a[x][i];
    }
}
void Dfs(int x, int y) {
  if (son[x]) {
    top[son[x]] = top[x];
    Dfs(son[x], x);
  }
  for (int i = 0; i < (int)a[x].size(); ++i)
    if (a[x][i] != y && a[x][i] != son[x]) {
      top[a[x][i]] = a[x][i];
      Dfs(a[x][i], x);
    }
}
bool cmp(P u, P v) { return fabs(u.t - v.t) < eps ? u.f > v.f : u.t < v.t; }
void jud(int p, int q) {
  if (!p || !q) return;
  --p;
  --q;
  if (a[m][p] == a[m][q]) {
    if (b[m][p] == b[m][q]) ans = min(ans, t);
    return;
  }
  double k = (b[m][q] - b[m][p]) / (a[m][p] - a[m][q]);
  if (k >= t - eps && k <= T[m][p].r + eps && k <= T[m][q].r + eps)
    ans = min(ans, k);
}
int main() {
  ans = 1100000;
  scanf("%d%d", &n, &m);
  for (int i = 1; i < n; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    a[x].push_back(y);
    a[y].push_back(x);
  }
  dfs(1, 0);
  top[1] = 1;
  Dfs(1, 0);
  for (int i = 1; i <= n; ++i) a[i].clear();
  for (int i = 1; i <= m; ++i) {
    double l, r, tt, hh;
    int cc, u, v, p, q;
    scanf("%lf%d%d%d", &tt, &cc, &u, &v);
    p = u;
    q = v;
    while (top[p] != top[q])
      if (h[top[p]] > h[top[q]])
        p = fa[top[p]];
      else
        q = fa[top[q]];
    if (h[p] < h[q]) q = p;
    hh = 1.0 * (h[u] + h[v] - h[q] - h[q]) / cc + tt;
    p = u;
    q = v;
    while (top[p] != top[q]) {
      if (h[top[p]] > h[top[q]]) {
        a[top[p]].push_back(-cc);
        l = tt + 1.0 * (h[u] - h[p]) / cc,
        r = l + 1.0 * (h[p] - h[top[p]] + 1) / cc;
        b[top[p]].push_back(h[p] + l * cc);
        T[top[p]].push_back((O){l, r});
        p = fa[top[p]];
      } else {
        a[top[q]].push_back(cc);
        r = hh - 1.0 * (h[v] - h[q]) / cc,
        l = r - 1.0 * (h[q] - h[top[q]] + 1) / cc;
        b[top[q]].push_back(h[q] - r * cc);
        T[top[q]].push_back((O){l, r});
        q = fa[top[q]];
      }
    }
    a[top[p]].push_back(h[p] < h[q] ? cc : -cc);
    l = tt + 1.0 * (h[u] - h[p]) / cc, r = l + 1.0 * abs(h[q] - h[p]) / cc;
    b[top[p]].push_back(h[p] - l * (h[p] < h[q] ? cc : -cc));
    T[top[p]].push_back((O){l, r});
  }
  for (m = 1; m <= n; ++m) {
    for (int j = 0; j < (int)a[m].size(); ++j) {
      w.push_back((P){T[m][j].l, j + 1});
      w.push_back((P){T[m][j].r, -j - 1});
    }
    sort(w.begin(), w.end(), cmp);
    rt = 0;
    for (int j = 0; j < (int)w.size(); ++j) {
      t = w[j].t;
      if (ans <= t + eps) break;
      if (w[j].f > 0) {
        lc[w[j].f] = rc[w[j].f] = 0;
        s[w[j].f] = 1;
        ll[w[j].f] = rr[w[j].f] = w[j].f;
        split(rt, w[j].f - 1, A, B);
        jud(rr[A], w[j].f);
        jud(ll[B], w[j].f);
        rt = merg(merg(A, w[j].f), B);
      } else {
        w[j].f *= -1;
        split(rt, w[j].f - 1, A, B);
        A = SPLIT(A);
        jud(rr[A], ll[B]);
        rt = merg(A, B);
      }
    }
    w.clear();
  }
  if (ans > 1000000)
    puts("-1");
  else
    printf("%.7lf\n", ans);
  return 0;
}