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>
inline int gi() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
int fir[100010], dis[200010], nxt[200010], id;
inline void link(int a, int b) { nxt[++id] = fir[a], fir[a] = id, dis[id] = b; }
int siz[100010], son[100010], fa[100010], dep[100010], top[100010];
inline void dfs(int x) {
  siz[x] = 1;
  for (int i = fir[x]; i; i = nxt[i]) {
    if (fa[x] == dis[i]) continue;
    fa[dis[i]] = x;
    dep[dis[i]] = dep[x] + 1;
    dfs(dis[i]);
    siz[x] += siz[dis[i]];
    if (siz[son[x]] < siz[dis[i]]) son[x] = dis[i];
  }
}
inline void dfs(int x, int tp) {
  top[x] = tp;
  if (son[x]) dfs(son[x], tp);
  for (int i = fir[x]; i; i = nxt[i])
    if (fa[x] != dis[i] && son[x] != dis[i]) dfs(dis[i], dis[i]);
}
inline int LCA(int a, int b) {
  while (top[a] != top[b])
    if (dep[top[a]] > dep[top[b]])
      a = fa[top[a]];
    else
      b = fa[top[b]];
  return dep[a] < dep[b] ? a : b;
}
struct naive {
  int st, ed, v;
  double t;
};
double nowt;
inline bool operator<(const naive& a, const naive& b) {
  double pa = a.st + a.v * (nowt - a.t), pb = b.st + b.v * (nowt - b.t);
  if (fabs(pa - pb) > 1e-10) return pa < pb;
  return a.t < b.t;
}
inline bool cmp_t(const naive& a, const naive& b) { return a.t < b.t; }
inline bool cmp_edt(const naive& a, const naive& b) {
  return a.t + (a.v ? fabs((a.st - a.ed) * 1.0 / a.v) : 0) <
         b.t + (b.v ? fabs((b.st - b.ed) * 1.0 / b.v) : 0);
}
inline double calc(const naive& a, const naive& b) {
  if (a.st == b.st && fabs(a.t - b.t) < 1e-10) return a.t;
  if (!a.v || !b.v) {
    if (a.v) {
      if (b.t > a.t && a.t + 1.0 * (b.st - a.st) / a.v == b.t) return b.t;
    } else if (b.v) {
      if (a.t > b.t && b.t + 1.0 * (a.st - b.st) / b.v == a.t) return a.t;
    }
    return 1e9;
  }
  if (a.v == b.v) {
    if (a.v && fabs(1.0 * (a.st - b.st) / a.v - b.t + a.t) > 1e-10) {
      if (a.t < b.t && fabs((b.t - a.t) * a.v + a.st - b.st) < 1e-10)
        return b.t;
      if (b.t <= a.t && fabs((a.t - b.t) * b.v + b.st - a.st) < 1e-10)
        return a.t;
    }
    return 1e9;
  }
  double ct, cx;
  ct = (b.st - a.st - a.v * (b.t - a.t)) / (a.v - b.v), cx = ct * b.v + b.st;
  if (fabs(a.st - cx) > 1e-10 && fabs(a.ed - cx) > 1e-10 &&
      (a.st - cx) * (a.ed - cx) > 0)
    return 1e9;
  if (fabs(b.st - cx) > 1e-10 && fabs(b.ed - cx) > 1e-10 &&
      (b.st - cx) * (b.ed - cx) > 0)
    return 1e9;
  return ct + b.t;
}
std::vector<naive> S[100010];
std::multiset<naive> st;
int main() {
  int n = gi(), m = gi(), a, b;
  for (int i = 1; i < n; ++i) a = gi(), b = gi(), link(a, b), link(b, a);
  dep[1] = 1;
  dfs(1), dfs(1, 1);
  int v, lca;
  double t;
  for (int i = 1; i <= m; ++i) {
    t = gi(), v = gi(), a = gi(), b = gi();
    if (a == b) {
      S[top[a]].push_back((naive){dep[a], dep[a], 0, t});
      continue;
    }
    lca = LCA(a, b);
    bool flg = 1;
    while (top[a] != top[lca]) {
      S[top[a]].push_back((naive){dep[a], dep[top[a]] - 1, -v, t});
      t += 1.0 * (dep[a] - dep[top[a]] + 1) / v;
      a = fa[top[a]];
    }
    if (a != lca) {
      S[top[a]].push_back((naive){dep[a], dep[lca], -v, t});
      if (top[a] == top[lca]) flg = 0;
    }
    t += 1.0 * (dep[a] - dep[lca]) / v;
    t += 1.0 * (dep[b] - dep[lca]) / v;
    while (top[b] != top[lca]) {
      t -= 1.0 * (dep[b] - dep[top[b]] + 1) / v;
      S[top[b]].push_back((naive){dep[top[b]] - 1, dep[b], v, t});
      b = fa[top[b]];
    }
    t -= 1.0 * (dep[b] - dep[lca]) / v;
    if (b != lca) {
      S[top[b]].push_back((naive){dep[lca], dep[b], v, t});
      if (top[b] == top[lca]) flg = 0;
    }
    if (flg) S[top[lca]].push_back((naive){dep[lca], dep[lca], 0, t});
  }
  double ans = 1e9;
  std::multiset<naive>::iterator pre, nxt;
  std::vector<naive> A, B;
  for (int x = 1; x <= n; ++x) {
    A = B = S[x];
    std::sort(A.begin(), A.end(), cmp_t);
    std::sort(B.begin(), B.end(), cmp_edt);
    st.clear();
    double res = 1e9;
    for (int i = 0, p = 0; i < A.size(); ++i) {
      while (p < B.size() &&
             B[p].t + (B[p].v ? fabs((B[p].st - B[p].ed) * 1.0 / B[p].v) : 0) +
                     1e-10 <
                 A[i].t) {
        st.erase(st.find(B[p]));
        nxt = st.lower_bound(B[p]);
        if (nxt != st.end() && nxt != st.begin())
          pre = nxt, --pre, res = std::min(res, calc(*pre, *nxt));
        ++p;
      }
      nowt = A[i].t;
      if (nowt + 1e-10 > res) goto ed;
      nxt = st.lower_bound(A[i]);
      if (nxt != st.end()) res = std::min(res, calc(A[i], *nxt));
      if (nxt != st.begin()) --nxt, res = std::min(res, calc(A[i], *nxt));
      st.insert(A[i]);
    }
  ed:
    ans = std::min(ans, res);
  }
  if (ans == 1e9)
    puts("-1");
  else
    printf("%.10lf\n", ans);
  return 0;
}