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 int N = 100010;
const double inf = 1e9;
const double eps = 1e-9;
int n, m;
vector<int> V[N];
int vis[N], dep[N], fa[N], son[N], siz[N], top[N];
void dfs(int x, int f) {
  int mx = 0;
  dep[x] = dep[f] + 1, fa[x] = f, siz[x] = 1;
  for (int i = 0; i < V[x].size(); i++) {
    int t = V[x][i];
    if (t == f) continue;
    dfs(t, x), siz[x] += siz[t];
    if (siz[t] > mx) mx = siz[t], son[x] = t;
  }
}
void dfss(int x, int tp) {
  top[x] = tp;
  if (son[x]) dfss(son[x], tp);
  for (int i = 0; i < V[x].size(); i++) {
    int t = V[x][i];
    if (t == fa[x] || t == son[x]) continue;
    dfss(t, t);
  }
}
inline int lca(int x, int y) {
  while (top[x] ^ top[y])
    dep[top[x]] < dep[top[y]] ? swap(x, y), 0 : 0, x = fa[top[x]];
  return dep[x] < dep[y] ? x : y;
}
double tot, ans = inf;
struct node {
  double t, pt;
  int p, v, tp;
  node() {}
  node(double tim, double pnt, int pos, int spd, int typ) {
    t = tim, pt = pnt, p = pos, v = spd, tp = typ;
  }
  friend bool operator<(node a, node b) {
    double ap = a.p + (tot - a.t) * a.v, bp = b.p + (tot - b.t) * b.v;
    if (fabs(ap - bp) < eps) return a.v < b.v;
    return ap < bp;
  }
} tmp;
multiset<node> S;
vector<node> P[N], L;
multiset<node>::iterator r, p;
double calc(node x, node y) {
  double px = x.p + (tot - x.t) * x.v, py = y.p + (tot - y.t) * y.v;
  if (fabs(x.v - y.v) < eps) return fabs(px - py) < eps ? 0.0 : inf;
  double ret = (px - py) / (y.v - x.v);
  if (ret + eps > 0.0 && tot + ret < min(x.pt, y.pt) + eps)
    return ret;
  else
    return inf;
}
inline void ins(int s, double &tim, double add, int pos, int v) {
  double x = tim, y = (tim += add);
  x > y ? x += eps, y -= eps : (y += eps, x -= eps);
  P[s].push_back(node(x, y, pos, v, x < y));
  P[s].push_back(node(y, x, pos, v, x > y));
}
inline void sol(int fr, int to, int t, int v) {
  int l = lca(fr, to);
  double tot = t + (double)(dep[fr] + dep[to] - dep[l] * 2) / v,
         tim = (double)t;
  while (top[fr] ^ top[l])
    ins(top[fr], tim, (double)(dep[fr] - dep[fa[top[fr]]]) / v, dep[fr], -v),
        fr = fa[top[fr]];
  while (top[to] ^ top[l])
    ins(top[to], tot, -(double)(dep[to] - dep[fa[top[to]]]) / v,
        dep[fa[top[to]]], v),
        to = fa[top[to]];
  ins(top[l], tim, tot - tim, dep[fr], dep[fr] < dep[to] ? v : -v);
}
bool cmp(node a, node b) {
  if (a.t == b.t) return a.tp > b.tp + eps;
  return a.t + eps < b.t;
}
int main() {
  scanf("%d%d", &n, &m), L.push_back(node());
  for (int x, y, i = 1; i < n; i++)
    scanf("%d%d", &x, &y), V[x].push_back(y), V[y].push_back(x);
  dfs(1, 0), dfss(1, 1);
  for (int fr, to, t, v, i = 1; i <= m; i++)
    scanf("%d%d%d%d", &t, &v, &fr, &to), sol(fr, to, t, v);
  for (int id = 1; id <= n; id++)
    if (!vis[top[id]]) {
      int x = top[id];
      vis[x] = true;
      double res = inf;
      S.clear();
      sort(P[x].begin(), P[x].end(), cmp);
      for (int i = 0; i < P[x].size(); i++) {
        tot = P[x][i].t;
        if (tot > res) break;
        if (P[x][i].tp) {
          r = S.lower_bound(P[x][i]);
          if (r != S.end()) res = min(res, tot + calc(*r, P[x][i]));
          r = S.lower_bound(P[x][i]);
          if (r != S.begin()) r--, res = min(res, tot + calc(*r, P[x][i]));
          S.insert(P[x][i]);
        } else {
          tmp = P[x][i], swap(tmp.t, tmp.pt);
          S.erase(S.find(tmp));
          r = S.lower_bound(tmp);
          p = S.lower_bound(tmp);
          if (r != S.end() && p != S.begin())
            p--, res = min(res, tot + calc(*r, *p));
        }
      }
      ans = min(ans, res);
    }
  ans == inf ? puts("-1") : printf("%.6lf\n", ans);
}