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;
namespace TYC {
const int N = 1e5 + 5;
const long double eps = 1e-12, INF = 1e100;
int n, m, dep[N], top[N], fa[N], size[N], son[N];
long double tim, ans = INF;
vector<int> E[N];
struct event {
  long double k, b, s, t;
};
vector<event> heavy[N], light[N];
multiset<event> S;
inline bool equal(const long double &a, const long double &b) {
  return fabs(a - b) < eps;
}
inline bool geq(const long double &a, const long double &b) {
  return a > b || equal(a, b);
}
inline bool leq(const long double &a, const long double &b) {
  return a < b || equal(a, b);
}
inline bool cmp(const pair<event, bool> &p, const pair<event, bool> &q) {
  long double a = p.second ? p.first.s : p.first.t;
  long double b = q.second ? q.first.s : q.first.t;
  return equal(a, b) ? p.second > q.second : a < b;
}
inline bool operator<(const event &p, const event &q) {
  if (equal(p.k * tim + p.b, q.k * tim + q.b)) {
    if (equal(p.s, q.s))
      return equal(p.t, q.t) ? p.k < q.k : p.t < q.t;
    else
      return p.s < q.s;
  } else
    return p.k * tim + p.b < q.k * tim + q.b;
}
void dfs(const int u) {
  size[u] = 1;
  for (int v : E[u])
    if (v != fa[u]) {
      dep[v] = dep[fa[v] = u] + 1;
      dfs(v);
      size[u] += size[v];
      if (size[v] > size[son[u]]) son[u] = v;
    }
}
void dfs(const int u, const int ance) {
  top[u] = ance;
  if (son[u]) dfs(son[u], ance);
  for (int v : E[u])
    if (v != fa[u] && v != son[u]) dfs(v, v);
}
inline int LCA(int u, int v) {
  while (top[u] != top[v]) {
    if (dep[top[u]] < dep[top[v]]) swap(u, v);
    u = fa[top[u]];
  }
  return dep[u] < dep[v] ? u : v;
}
inline int dist(const int u, const int v) {
  return dep[u] + dep[v] - dep[LCA(u, v)] * 2;
}
void upload(int u, int v, long double s, long double c) {
  long double t = s + dist(u, v) / c;
  while (top[u] != top[v]) {
    if (dep[top[u]] > dep[top[v]]) {
      int p = top[u];
      heavy[p].push_back({-c, dep[u] + c * s, s, s + (dep[u] - dep[p]) / c});
      s += (dep[u] - dep[p]) / c;
      light[p].push_back({-c, dep[p] + c * s, s, s + 1 / c});
      s += 1 / c;
      u = fa[p];
    } else {
      int p = top[v];
      heavy[p].push_back({c, dep[v] - c * t, t - (dep[v] - dep[p]) / c, t});
      t -= (dep[v] - dep[p]) / c;
      light[p].push_back({c, dep[p] - c * t, t - 1 / c, t});
      t -= 1 / c;
      v = fa[p];
    }
  }
  int p = top[u];
  if (dep[u] > dep[v])
    heavy[p].push_back({-c, dep[u] + c * s, s, t});
  else
    heavy[p].push_back({c, dep[v] - c * t, s, t});
}
long double cross(const event &p, const event &q) {
  if (equal(p.k, q.k)) {
    if (equal(p.b, q.b))
      return max(p.s, q.s);
    else
      return INF;
  }
  long double t = (q.b - p.b) / (p.k - q.k);
  return (leq(max(p.s, q.s), t) && leq(t, min(p.t, q.t))) ? t : INF;
}
void solve(vector<event> &tmp) {
  static vector<pair<event, bool> > V;
  V.clear();
  S.clear();
  for (auto p : tmp) {
    V.push_back({p, true});
    V.push_back({p, false});
  }
  sort(V.begin(), V.end(), cmp);
  long double goal = INF;
  int cnt = 0;
  for (auto p : V) {
    tim = p.second ? p.first.s : p.first.t;
    if (geq(tim, goal)) return void(ans = min(ans, goal));
    if (p.second) {
      multiset<event>::iterator t = S.insert(p.first), pre = t, nxt = t;
      if (pre != S.begin()) goal = min(goal, cross(*(--pre), *t));
      if (++nxt != S.end()) goal = min(goal, cross(*nxt, *t));
    } else {
      multiset<event>::iterator t = S.lower_bound(p.first), pre = t, nxt = t;
      if (++nxt != S.end() && pre != S.begin())
        goal = min(goal, cross(*(--pre), *nxt));
      S.erase(t);
    }
  }
}
void work() {
  scanf("%d%d", &n, &m);
  for (int i = 1, u, v; i < n; i++) {
    scanf("%d%d", &u, &v);
    E[u].push_back(v);
    E[v].push_back(u);
  }
  dfs(1);
  dfs(1, 1);
  for (int i = 1, t, c, u, v; i <= m; i++) {
    scanf("%d%d%d%d", &t, &c, &u, &v);
    upload(u, v, (long double)t, (long double)c);
  }
  for (int i = 1; i <= n; i++) {
    solve(heavy[i]);
    solve(light[i]);
  }
  if (geq(ans, INF))
    puts("-1");
  else
    printf("%.10f\n", (double)ans);
}
}  // namespace TYC
int main() {
  TYC::work();
  return 0;
}