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;
const double Inf = 1e18;
const int N = 3e5 + 9;
double ans = Inf;
double x;
const double eps = 1e-10;
struct line {
  double lx, rx, ly, ry, k;
  line(double lx = 0, double ly = 0, double rx = 0, double ry = 0, double k = 0)
      : lx(lx), ly(ly), rx(rx), ry(ry), k(k) {}
  double cal(double x) { return ly + (x - lx) * k; }
} q[N];
struct cmp {
  bool operator()(const int &a, const int &b) {
    return q[a].cal(x) < q[b].cal(x);
  }
};
struct query {
  double x;
  int id;
  query(double x = 0, int id = 0) : x(x), id(id) {}
  bool operator<(const query &o) const {
    if (fabs(x - o.x) < eps) return id > o.id;
    return x < o.x;
  }
} que[N];
void upd(int idx, int idy) {
  if (q[idx].lx > q[idy].lx) swap(idx, idy);
  if (q[idx].rx + eps < q[idy].lx) return;
  double y = q[idx].cal(q[idy].lx);
  if (fabs(q[idx].k - q[idy].k) < eps) {
    if (fabs(y - q[idy].ly) < eps) ans = min(ans, q[idy].lx);
    return;
  }
  double px = (q[idy].ly - y) / (q[idx].k - q[idy].k);
  if (px < -eps || px + q[idy].lx > min(q[idx].rx, q[idy].rx) + eps) return;
  ans = min(ans, px + q[idy].lx);
}
set<int, cmp> S;
void erase(int id) {
  S.erase(id);
  set<int, cmp>::iterator pre, nxt;
  pre = nxt = S.lower_bound(id);
  if (pre != S.begin() && nxt != S.end()) upd(*(--pre), *nxt);
}
void insert(int id) {
  set<int, cmp>::iterator pre, nxt;
  pre = nxt = S.lower_bound(id);
  if (pre != S.begin()) upd(*(--pre), id);
  if (nxt != S.end()) upd(*(nxt), id);
  S.insert(id);
}
void solve(const vector<line> &vec) {
  int top = 0;
  for (int i = (0); i < (vec.size()); ++i) {
    q[i + 1] = vec[i];
    que[++top] = query(q[i + 1].lx, i + 1);
    que[++top] = query(q[i + 1].rx, -i - 1);
  }
  S.clear();
  sort(que + 1, que + top + 1);
  for (int i = (1); i < (top + 1); ++i) {
    x = que[i].x;
    if (x + eps >= ans) break;
    if (que[i].id < 0)
      erase(-que[i].id);
    else
      insert(que[i].id);
  }
}
vector<line> G[N];
vector<int> g[N];
int sz[N], top[N], fa[N], dep[N];
void dfs(int u, int f) {
  fa[u] = f;
  dep[u] = dep[f] + 1;
  sz[u] = 1;
  for (auto v : g[u]) {
    if (v == f) continue;
    dfs(v, u);
    sz[u] += sz[v];
  }
}
void dfs2(int u, int tp) {
  int p = 0;
  top[u] = tp;
  for (auto v : g[u]) {
    if (v == fa[u]) continue;
    if (sz[v] > sz[p]) p = v;
  }
  if (p) dfs2(p, tp);
  for (auto v : g[u]) {
    if (v == fa[u] || v == p) continue;
    dfs2(v, v);
  }
}
int LCA(int u, int v) {
  for (; top[u] != top[v]; u = fa[top[u]]) {
    if (dep[top[u]] < dep[top[v]]) swap(u, v);
  }
  if (dep[u] < dep[v]) return u;
  return v;
}
int dis(int x, int y) { return dep[x] + dep[y] - 2 * dep[LCA(x, y)]; }
void add(int u, int v, double S, double T, double k) {
  int L = LCA(u, v);
  for (; top[u] != top[L]; u = fa[top[u]]) {
    int len = dep[u] - dep[top[u]] + 1;
    G[top[u]].push_back(line(S, len, S + 1.0 * len / k, 0, -k));
    S += 1.0 * len / k;
  }
  for (; top[v] != top[L]; v = fa[top[v]]) {
    int len = dep[v] - dep[top[v]] + 1;
    G[top[v]].push_back(line(T - 1.0 * len / k, 0, T, len, k));
    T -= 1.0 * len / k;
  }
  int px = dep[u] - dep[top[u]] + 1;
  int py = dep[v] - dep[top[v]] + 1;
  if (dep[u] > dep[v])
    G[top[u]].push_back(line(S, px, T, py, -k));
  else
    G[top[u]].push_back(line(S, px, T, py, k));
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = (1); i < (n); ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    g[u].push_back(v), g[v].push_back(u);
  }
  dfs(1, 0);
  dfs2(1, 1);
  for (int i = (0); i < (m); ++i) {
    int u, v, k, t;
    scanf("%d%d%d%d", &t, &k, &u, &v);
    add(u, v, t, t + 1.0 * dis(u, v) / k, k);
  }
  for (int i = (1); i < (n + 1); ++i)
    if (top[i] == i) solve(G[i]);
  if (ans > 1e6) return printf("-1"), 0;
  printf("%.10lf\n", ans);
}