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;
template <class T>
inline void rd(T &x) {
  x = 0;
  char c = getchar();
  int f = 1;
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 - '0' + c, c = getchar();
  x *= f;
}
const long double eps = 1e-8;
int dcmp(long double x) { return x > -eps ? (x > eps) : -1; }
namespace Sol {
long double curt;
}
struct Line {
  long double k, b, l, r;
  Line(long double k = 0, long double b = 0, long double l = -1e19,
       long double r = 1e19)
      : k(k), b(b), r(r) {}
  long double cal(long double x) { return k * x + b; }
  friend bool operator<(Line A, Line B) {
    if (dcmp(A.cal(Sol::curt) - B.cal(Sol::curt)))
      return dcmp(A.cal(Sol::curt) - B.cal(Sol::curt)) < 0;
    long double tl = max(A.l, B.l);
    if (dcmp(A.cal(tl) - B.cal(tl))) return dcmp(A.cal(tl) - B.cal(tl)) < 0;
    if (dcmp(A.k - B.k)) return dcmp(A.k - B.k) < 0;
    if (dcmp(A.b - B.b)) return dcmp(A.b - B.b) < 0;
    if (dcmp(A.l - B.l)) return dcmp(A.l - B.l) < 0;
    return dcmp(A.r - B.r) < 0;
  }
};
struct Event {
  Line l;
  long double p;
  int ty;
  Event(Line l, long double p = 0, int ty = 0) : l(l), p(p), ty(ty) {}
  friend bool operator==(Line A, Line B) {
    return dcmp(A.k - B.k) == 0 && dcmp(A.b - B.b) == 0;
  }
};
namespace Sol {
multiset<Line> S;
bool cmpt(Event A, Event B) {
  if (dcmp(A.p - B.p) == 0) {
    if (A.ty == B.ty) return A.l < B.l;
    return A.ty > B.ty;
  }
  return A.p < B.p;
}
long double ans;
void UPD(Line A, Line B, long double t) {
  long double L = max(A.l, B.l), R = min(A.r, B.r);
  if (dcmp(L - R) > 0) return;
  if (dcmp(A.k - B.k) == 0) {
    if (dcmp(A.b - B.b) == 0) ans = min(ans, L);
    return;
  }
  long double tmp = (A.b - B.b) / (B.k - A.k);
  if (dcmp(tmp - L) >= 0 && dcmp(tmp - R) <= 0) ans = min(ans, tmp);
}
long double sol(vector<Event> &A) {
  S.clear();
  sort(A.begin(), A.end(), cmpt);
  curt = -1e19;
  ans = 1e19;
  for (int i = 0; i < A.size(); ++i) {
    if (dcmp(A[i].p - ans) > 0) break;
    multiset<Line>::iterator it, it2;
    curt = A[i].p;
    if (A[i].ty == 1) {
      it = S.upper_bound(A[i].l);
      if (it != S.end()) UPD(*it, A[i].l, A[i].p);
      if (it != S.begin()) UPD(*(--it), A[i].l, A[i].p);
      S.insert(A[i].l);
    } else {
      S.erase(S.lower_bound(A[i].l));
      it = S.upper_bound(A[i].l);
      if (it != S.end() && it != S.begin()) {
        it2 = it;
        it2--;
        UPD(*it, *it2, A[i].p);
      }
    }
  }
  return ans;
}
}  // namespace Sol
const int N = 1e5 + 10;
int head[N], ecnt, n, m;
struct ed {
  int to, next;
} e[N << 1];
void ad(int x, int y) {
  e[++ecnt] = (ed){y, head[x]};
  head[x] = ecnt;
  e[++ecnt] = (ed){x, head[y]};
  head[y] = ecnt;
}
int dep[N], sz[N], son[N], fa[N], top[N];
void dfs1(int u, int last) {
  sz[u] = 1, dep[u] = dep[fa[u] = last] + 1;
  for (int k = head[u]; k; k = e[k].next) {
    int v = e[k].to;
    if (v == last) continue;
    dfs1(v, u);
    sz[u] += sz[v];
    if (sz[v] > sz[son[u]]) son[u] = v;
  }
}
void dfs2(int u, int tp) {
  top[u] = tp;
  if (son[u]) dfs2(son[u], tp);
  for (int k = head[u]; k; k = e[k].next) {
    int v = e[k].to;
    if (v == fa[u] || v == son[u]) continue;
    dfs2(v, v);
  }
}
int LCA(int x, int y) {
  while (top[x] != top[y])
    dep[fa[top[x]]] > dep[fa[top[y]]] ? x = fa[top[x]] : y = fa[top[y]];
  return dep[x] > dep[y] ? y : x;
}
vector<Event> W[N];
void add(int x, Line L, long double l, long double r) {
  if (l > r) swap(l, r);
  L.r = r, L.l = l;
  W[x].push_back(Event(L, l, 1));
  W[x].push_back(Event(L, r, -1));
}
int ff;
void upd(int x, int f, long double s, long double c, Line L) {
  while (top[x] != top[f]) {
    long double s1 = s - (dep[x] - dep[top[x]] + 1) / c;
    add(top[x], L, s, s1);
    s = s1;
    x = fa[top[x]];
  }
  if (x == f)
    return;
  else
    ff = 1;
  long double s1 = s - (dep[x] - dep[f]) / c;
  add(top[x], L, s, s1);
}
int main() {
  rd(n), rd(m);
  for (int i = 1, x, y; i < n; ++i) rd(x), rd(y), ad(x, y);
  dfs1(1, 0), dfs2(1, 1);
  for (int i = 1; i <= m; ++i) {
    int t, _c, x, y;
    rd(t), rd(_c), rd(x), rd(y);
    long double c = _c;
    int L = LCA(x, y);
    long double ts = t + (dep[x] + dep[y] - 2 * dep[L]) / c;
    ff = 0;
    if (x != L) upd(x, L, t, -c, Line(-c, dep[x] + c * t, -1e19, 1e19));
    if (y != L) upd(y, L, ts, c, Line(c, dep[y] - c * ts, -1e19, 1e19));
    if (!ff) {
      long double tmp = t + (dep[x] - dep[L]) / c;
      add(top[L], Line(c, dep[y] - c * ts, -1e19, 1e19), tmp, tmp);
    }
  }
  long double ans = 1e19;
  for (int i = n; i >= 1; --i)
    if (top[i] == i) ans = min(ans, Sol::sol(W[i]));
  if (ans > 1e18)
    printf("-1");
  else
    printf("%.7Lf\n", ans);
  return 0;
}