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>
const double eps = 1e-9;
const int N = 100005;
using namespace std;
int n, m, to[N * 2], hd[N * 2], lk[N], cnt, f[N], sz[N], de[N], top[N], son[N];
double ans = 1e9, sc, sp;
struct dat {
  int k;
  double tl, tr;
  int b;
  friend bool operator<(dat x, dat y) {
    return x.b + (sc - x.tl) * x.k < y.b + (sc - y.tl) * y.k;
  }
};
vector<dat> ins[N], del[N];
set<dat> S;
set<dat>::iterator il, it, ir;
inline void add(int u, int v) { to[++cnt] = v, hd[cnt] = lk[u], lk[u] = cnt; }
void dfs(int x) {
  sz[x] = 1;
  for (int s, i = lk[x]; i; i = hd[i])
    if ((s = to[i]) ^ f[x])
      f[s] = x, de[s] = de[x] + 1, dfs(s), sz[x] += sz[s],
      sz[son[x]] < sz[s] ? son[x] = s : 0;
}
void dfss(int x) {
  !top[x] ? top[x] = x : 0;
  top[son[x]] = top[x];
  for (int i = lk[x]; i; i = hd[i])
    if (f[to[i]] == x) dfss(to[i]);
}
int t, c, u, v, w, tp;
inline void lca(int u, int v) {
  for (; top[u] ^ top[v]; u = f[top[u]])
    if (de[top[u]] < de[top[v]]) swap(u, v);
  w = de[u] < de[v] ? u : v;
}
bool cmp(dat x, dat y) { return x.tl < y.tl; }
inline void cal(dat x, dat y) {
  if (abs(x.k - y.k) < eps) {
    if (abs(y.b - x.b + x.k * x.tl - y.k * y.tl) < eps)
      ans = min(ans, max(x.tl, y.tl));
    return;
  }
  double re = (y.b - x.b + x.k * x.tl - y.k * y.tl) / (x.k - y.k);
  if (re + eps > max(x.tl, y.tl) && re < min(x.tr, y.tr) + eps)
    ans = min(ans, re);
}
inline void sol(vector<dat> I, vector<dat> D) {
  sort(I.begin(), I.end(), cmp);
  sort(D.begin(), D.end(), cmp);
  for (int i = 0, j = 0; i < I.size() && j < D.size();)
    if (D[j].tl + eps < I[i].tl) {
      if (D[j].tl + eps > ans) break;
      sc = D[j].tl;
      D[j].tl += eps;
      il = ir = it = S.lower_bound(D[j]), ir++;
      assert(it != S.end());
      if (il != S.begin() && ir != S.end()) cal(*--il, *ir);
      S.erase(it);
      j++;
    } else {
      if (I[i].tl + eps > ans) break;
      sc = I[i].tl;
      il = ir = S.lower_bound(I[i]);
      if (il != S.begin()) cal(*--il, I[i]);
      if (ir != S.end()) cal(I[i], *ir);
      S.insert(I[i++]);
    }
  S.clear();
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i < n; i++) scanf("%d%d", &u, &v), add(u, v), add(v, u);
  dfs(1), dfss(1);
  for (; m--;) {
    scanf("%d%d%d%d", &t, &c, &u, &v);
    lca(u, v), sc = t;
    for (;; u = f[tp]) {
      sp = sc, tp = top[u];
      if (tp == top[w]) {
        sc += (double)(de[u] - de[w]) / c;
        if (sp + eps < sc)
          del[tp].push_back({-c, sc - 10 * eps, sc, de[w]}),
              ins[tp].push_back({-c, sp, sc - 10 * eps, de[u]});
        break;
      }
      sc += (double)(de[u] - de[f[tp]]) / c;
      if (sp + eps < sc)
        del[tp].push_back({-c, sc - 10 * eps, sc, de[f[tp]]}),
            ins[tp].push_back({-c, sp, sc - 10 * eps, de[u]});
    }
    sc += (double)(de[v] - de[w]) / c;
    for (;; v = f[tp]) {
      sp = sc, tp = top[v];
      del[tp].push_back({c, sp, sp, de[v]});
      if (tp == top[w]) {
        sc -= (double)(de[v] - de[w]) / c;
        ins[tp].push_back({c, sc, sp, de[w]});
        break;
      }
      sc -= (double)(de[v] - de[f[tp]]) / c;
      ins[tp].push_back({c, sc, sp, de[f[tp]]});
    }
  }
  for (int i = 1; i <= n; i++) sol(ins[i], del[i]);
  if (ans < 1e8)
    printf("%.7lf", ans);
  else
    puts("-1");
}