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>
#pragma GCC optimize("-O3")
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
void Out(int x) {
  if (x > 9) Out(x / 10);
  putchar('0' + x % 10);
}
const int N = 2e5 + 50;
const double eps = 1e-8;
int A, B, rt, n, m, son[N], dep[N], fa[N], tp[N], s[N];
double t, ans;
vector<int> a[N];
vector<double> b[N];
struct O {
  double l, r;
};
vector<O> T[N];
struct P {
  double t;
  int f;
};
vector<P> w;
int lc[N], rc[N], ll[N], rr[N];
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;
  dep[x] = dep[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]) {
    tp[son[x]] = tp[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]) {
      tp[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);
  tp[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 (tp[p] != tp[q])
      if (dep[tp[p]] > dep[tp[q]])
        p = fa[tp[p]];
      else
        q = fa[tp[q]];
    if (dep[p] < dep[q]) q = p;
    hh = 1.0 * (dep[u] + dep[v] - dep[q] - dep[q]) / cc + tt;
    p = u;
    q = v;
    while (tp[p] != tp[q]) {
      if (dep[tp[p]] > dep[tp[q]]) {
        a[tp[p]].push_back(-cc);
        l = tt + 1.0 * (dep[u] - dep[p]) / cc;
        r = l + 1.0 * (dep[p] - dep[tp[p]] + 1) / cc;
        b[tp[p]].push_back(dep[p] + l * cc);
        T[tp[p]].push_back((O){l, r});
        p = fa[tp[p]];
      } else {
        a[tp[q]].push_back(cc);
        r = hh - 1.0 * (dep[v] - dep[q]) / cc,
        l = r - 1.0 * (dep[q] - dep[tp[q]] + 1) / cc;
        b[tp[q]].push_back(dep[q] - r * cc);
        T[tp[q]].push_back((O){l, r});
        q = fa[tp[q]];
      }
    }
    a[tp[p]].push_back(dep[p] < dep[q] ? cc : -cc);
    l = tt + 1.0 * (dep[u] - dep[p]) / cc,
    r = l + 1.0 * abs(dep[q] - dep[p]) / cc;
    b[tp[p]].push_back(dep[p] - l * (dep[p] < dep[q] ? cc : -cc));
    T[tp[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;
}