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>
namespace Long {
const int N = 101000, INF = 1000000007;
const double eps = 1e-7;
bool cmp(double a, double b) { return std::abs(a - b) < eps; }
double cur;
struct suit {
  int u, v, c;
  double t;
  suit(int u0 = 0, int v0 = 0, int c0 = 0, double t0 = 0) {
    u = u0, v = v0, c = c0 * (u < v ? 1 : -1), t = t0;
  }
  double begin() { return t; }
  double end() { return t + (v - u) * 1.0 / c; }
  bool operator<(const suit &A) const {
    assert(cur + eps > t && cur + eps > A.t);
    double x = u + (cur - t) * c, y = A.u + (cur - A.t) * A.c;
    return x < y;
  }
};
struct node {
  double t;
  int id, ty;
  node(double t0 = 0, int id0 = 0, int ty0 = 0) : t(t0), id(id0), ty(ty0) {}
  bool operator<(const node &A) const {
    return cmp(t, A.t) ? ty > A.ty : t < A.t;
  }
};
std::multiset<suit> S;
struct fucker {
  std::vector<std::set<suit>::iterator> ad;
  std::vector<suit> s;
  std::vector<node> t;
  inline void insert(suit A) { s.push_back(A); }
  double cross(suit A, suit B) {
    if (A.t > B.t) std::swap(A, B);
    if (A.end() + eps < B.begin()) return INF;
    double dt = B.begin() - A.begin(), pa = A.u + A.c * dt;
    double dx = pa - B.u, dc = A.c - B.c;
    if (cmp(dx, 0)) return B.begin();
    if (dx > eps && dc > -eps) return INF;
    if (dx < -eps && dc < eps) return INF;
    double ct = B.begin() - dx / dc;
    if (ct > A.end() + eps || ct > B.end() + eps) return INF;
    return ct;
  }
  double solve() {
    ad.resize(s.size());
    for (int i = 0; i < (int)s.size(); i++) {
      t.push_back(node(s[i].begin(), i, 1));
      t.push_back(node(s[i].end(), i, 0));
    }
    std::sort(t.begin(), t.end());
    S.clear();
    std::set<suit>::iterator it, pre, suc;
    double ret = INF;
    suit x;
    for (int i = 0; i < (int)t.size(); i++) {
      if (t[i].t > ret + eps) break;
      cur = t[i].t;
      if (t[i].ty) {
        x = s[t[i].id];
        it = S.insert(x);
        ad[t[i].id] = it;
        if (it != S.begin())
          --(pre = it), ret = std::min(ret, cross(*it, *pre));
        if (++(suc = it) != S.end()) ret = std::min(ret, cross(*it, *suc));
      } else {
        it = ad[t[i].id];
        if (it != S.begin() && ++(suc = it) != S.end())
          --(pre = it), ret = std::min(ret, cross(*pre, *suc));
        S.erase(it);
      }
    }
    return ret;
  }
} G[N];
int begin[N], next[N * 2], to[N * 2];
int n, m, e;
void add(int x, int y, bool k = 1) {
  to[++e] = y;
  next[e] = begin[x];
  begin[x] = e;
  if (k) add(y, x, 0);
}
int dep[N], top[N], fa[N];
int predfs(int p = 1, int h = 0) {
  fa[p] = h, top[p] = p, dep[p] = dep[h] + 1;
  int sizp = 1, sizq, maxsiz = 0, maxson = 0;
  for (int i = begin[p], q; i; i = next[i])
    if ((q = to[i]) != h) {
      sizp += (sizq = predfs(q, p));
      if (sizq > maxsiz) maxsiz = sizq, maxson = q;
    }
  if (maxson) top[maxson] = p;
  return sizp;
}
void redfs(int p = 1, int h = 0) {
  for (int i = begin[p], q; i; i = next[i])
    if ((q = to[i]) != h) {
      if (top[q] == p) top[q] = top[p];
      redfs(q, p);
    }
}
int getlca(int u, int v) {
  if (top[u] == top[v]) return dep[u] < dep[v] ? u : v;
  if (dep[top[u]] > dep[top[v]]) std::swap(u, v);
  return getlca(u, fa[top[v]]);
}
inline int id(int p) { return dep[p] - dep[top[p]] + 1; }
void work(int u, int v, int c, double tu, double tv) {
  if (top[u] == top[v])
    G[top[u]].insert(suit(id(u), id(v), c, tu));
  else if (dep[top[u]] <= dep[top[v]]) {
    double ct = id(v) * 1.0 / c;
    G[top[v]].insert(suit(0, id(v), c, tv - ct));
    work(u, fa[top[v]], c, tu, tv - ct);
  } else {
    double ct = id(u) * 1.0 / c;
    G[top[u]].insert(suit(id(u), 0, c, tu));
    work(fa[top[u]], v, c, tu + ct, tv);
  }
}
void initialize() {
  scanf("%d%d", &n, &m);
  for (int i = 1, u, v; i < n; i++) scanf("%d%d", &u, &v), add(u, v);
  predfs(), redfs();
  for (int i = 1, u, v, c, t, dis; i <= m; i++) {
    scanf("%d%d%d%d", &t, &c, &u, &v);
    dis = dep[u] + dep[v] - dep[getlca(u, v)] * 2;
    work(u, v, c, t, t + dis * 1.0 / c);
  }
}
void solve() {
  initialize();
  double ans = INF;
  for (int i = 1; i <= n; i++) ans = std::min(ans, G[i].solve());
  if (ans + eps >= INF)
    printf("-1\n");
  else
    printf("%.10lf\n", ans);
}
}  // namespace Long
int main() {
  Long::solve();
  return 0;
}