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 db = double;
const int N = 100007;
const db eps = 1e-10, inf = 1e10;
int n, m, fa[N], dep[N], size[N], son[N], top[N], vis[N];
db ans = inf, t, c[N], ed[N];
struct line {
  int x, id, o;
  db t, c;
} b[N];
db cal(const line& x) { return dep[x.x] + (t - x.t) * c[x.id]; }
int operator<(const line& a, const line& b) { return cal(a) < cal(b); }
std::vector<int> e[N];
std::vector<line> f[N];
std::multiset<line> s;
int read() {
  int x = 0, c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) (x *= 10) += c & 15, c = getchar();
  return x;
}
void dfs(int u) {
  size[u] = 1;
  for (int v : e[u])
    if (v ^ fa[u])
      fa[v] = u, dep[v] = dep[u] + 1, dfs(v), size[u] += size[v],
      son[u] = size[v] > size[son[u]] ? v : son[u];
}
void dfs(int u, int tp) {
  top[u] = tp;
  if (son[u]) dfs(son[u], tp);
  for (int v : e[u])
    if (v ^ fa[u] && v ^ son[u]) dfs(v, v);
}
int lca(int u, int v) {
  for (; top[u] ^ top[v]; u = fa[top[u]])
    if (dep[top[v]] > dep[top[u]]) std::swap(u, v);
  return dep[u] > dep[v] ? v : u;
}
db cal(int u, int v, db c) { return (dep[u] - dep[v]) / c; }
void update(const line& x, const line& y) {
  db v = cal(y) - cal(x),
     p = fabs(v) < eps ? 0 : (cal(y) - cal(x)) / (c[x.id] - c[y.id]);
  if (p > -eps && p + t < std::min(ed[x.id], ed[y.id]) + eps)
    ans = std::min(ans, p + t);
}
void work(int u) {
  s.clear(),
      std::sort(f[u].begin(), f[u].end(), [](const line& a, const line& b) {
        return fabs(a.t - b.t) < eps ? a.o > b.o : a.t < b.t;
      });
  for (line x : f[u])
    if (x.o)
      b[x.id] = x;
    else
      ed[x.id] = x.t;
  for (line x : f[u]) {
    if ((t = x.t) > ans + eps) break;
    if (x.o) {
      auto it = s.insert(x);
      c[x.id] = x.c;
      if (it != s.begin()) update(x, *prev(it));
      if (++it != s.end()) update(x, *it);
    } else {
      auto it = s.find(b[x.id]);
      if (it != s.begin() && next(it) != s.end()) update(*prev(it), *next(it));
      if (it != s.end()) s.erase(it);
    }
  }
}
int main() {
  n = read(), m = read();
  for (int i = 1, u, v; i < n; ++i)
    u = read(), v = read(), e[u].push_back(v), e[v].push_back(u);
  dfs(1), dfs(1, 1);
  for (int i = 1; i <= m; ++i) {
    db t = read(), T;
    c[i] = read();
    int x = read(), y = read(), u = x, v = y, p = lca(u, v), flg = 1;
    T = t + cal(u, p, c[i]);
    for (; top[u] ^ top[v]; u = fa[top[u]]) {
      if (dep[top[u]] < dep[top[v]]) std::swap(u, v), flg ^= 1;
      if (flg)
        f[top[u]].push_back({u, i, 1, t + cal(x, u, c[i]), -c[i]}),
            f[top[u]].push_back(
                {fa[top[u]], i, 0, t + cal(x, fa[top[u]], c[i]), -c[i]});
      else
        f[top[u]].push_back({u, i, 0, T + cal(u, p, c[i]), c[i]}),
            f[top[u]].push_back(
                {fa[top[u]], i, 1, T + cal(fa[top[u]], p, c[i]), c[i]});
    }
    if (dep[u] < dep[v]) std::swap(u, v), flg ^= 1;
    if (flg)
      f[top[u]].push_back({u, i, 1, t + cal(x, u, c[i]), -c[i]}),
          f[top[u]].push_back({v, i, 0, T, -c[i]});
    else
      f[top[u]].push_back({v, i, 1, T, c[i]}),
          f[top[u]].push_back({u, i, 0, T + cal(u, v, c[i]), c[i]});
  }
  for (int i = 1; i <= n; ++i)
    if (!vis[top[i]]) vis[top[i]] = 1, work(top[i]);
  fabs(ans - inf) < eps ? puts("-1") : printf("%.10lf", ans);
}