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 <typename T1, typename T2>
inline T1 max(T1 a, T2 b) {
  return a < b ? b : a;
}
template <typename T1, typename T2>
inline T1 min(T1 a, T2 b) {
  return a < b ? a : b;
}
const char lf = '\n';
namespace ae86 {
const int bufl = 1 << 15;
char buf[bufl], *s = buf, *t = buf;
inline int fetch() {
  if (s == t) {
    t = (s = buf) + fread(buf, 1, bufl, stdin);
    if (s == t) return EOF;
  }
  return *s++;
}
inline int ty() {
  int a = 0;
  int b = 1, c = fetch();
  while (!isdigit(c)) b ^= c == '-', c = fetch();
  while (isdigit(c)) a = a * 10 + c - 48, c = fetch();
  return b ? a : -a;
}
}  // namespace ae86
using ae86::ty;
const int _ = 100007, __ = _ << 1;
const long double eps = 1e-13, inf = 1e99;
inline int dcmp(long double x) {
  if (-eps < x && x < eps) return 0;
  return x > 0 ? 1 : -1;
}
int to[__], ne[__], he[_] = {0}, ecnt = 1;
inline void adde(int a, int b) {
  to[++ecnt] = b, ne[ecnt] = he[a], he[a] = ecnt;
}
inline void addde(int a, int b) { adde(a, b), adde(b, a); }
int fa[_] = {0}, dep[_] = {0}, sz[_] = {0}, mxch[_] = {0};
void dfs(int x, int ff) {
  fa[x] = ff, dep[x] = dep[ff] + 1, sz[x] = 1, mxch[x] = 0;
  for (int i = he[x]; i; i = ne[i]) {
    int b = to[i];
    if (b == ff) continue;
    dfs(b, x), sz[x] += sz[b];
    if (sz[mxch[x]] < sz[b]) mxch[x] = b;
  }
}
int dfn[_] = {0}, dcnt = 0, top[_] = {0};
void dfs2(int x, int tp) {
  dfn[x] = ++dcnt, top[x] = tp;
  if (mxch[x]) dfs2(mxch[x], tp);
  for (int i = he[x]; i; i = ne[i]) {
    int b = to[i];
    if (b == fa[x] || b == mxch[x]) continue;
    dfs2(b, b);
  }
}
int lca(int a, int b) {
  while (top[a] != top[b]) {
    if (dep[top[a]] < dep[top[b]]) swap(a, b);
    a = fa[top[a]];
  }
  if (dep[a] > dep[b]) swap(a, b);
  return a;
}
inline int distan(int a, int b) { return dep[a] + dep[b] - 2 * dep[lca(a, b)]; }
inline int distan(int a, int b, int c) { return dep[a] + dep[b] - 2 * dep[c]; }
long double now;
struct cxk {
  long double st, ta;
  int bas, spd, dir;
  cxk(long double st_ = 0, long double ta_ = 0, int bas_ = 0, int spd_ = 0,
      int dir_ = 0) {
    st = st_, ta = ta_, bas = bas_, spd = spd_, dir = dir_;
  }
  long double f(long double x) { return bas + (x - st) * spd; }
  friend bool operator<(cxk a, cxk b) {
    long double fa = a.f(now), fb = b.f(now);
    if (dcmp(fa - fb) == 0) return a.spd < b.spd;
    return fa < fb;
  }
};
long double cxkdlq(cxk a, cxk b) {
  long double pa = a.f(now), pb = b.f(now);
  if (dcmp(a.spd - b.spd) == 0) return dcmp(pa - pb) == 0 ? 0 : inf;
  long double tim = (pa - pb) / (b.spd - a.spd);
  if (dcmp(tim) >= 0 && dcmp(now + tim - min(a.ta, b.ta)) <= 0) return tim;
  return inf;
}
vector<cxk> dlq[_];
int n, m;
void dreamin(int fr, long double st, long double ta, int spd, int deep) {
  if (st > ta)
    st += eps, ta -= eps;
  else
    st -= eps, ta += eps;
  dlq[fr].emplace_back(st, ta, deep, spd, st < ta);
  dlq[fr].emplace_back(ta, st, deep, spd, ta < st);
}
void pusheen(int st, int spd, int a, int b) {
  int c = lca(a, b);
  long double ta = st + 1.00 * distan(a, b, c) / spd;
  long double frt = st;
  while (top[a] != top[c]) {
    long double co = 1.00 * (dep[a] - dep[fa[top[a]]]) / spd;
    dreamin(top[a], frt, frt + co, -spd, dep[a]), a = fa[top[a]], frt += co;
  }
  long double tot = ta;
  while (top[b] != top[c]) {
    long double co = -1.00 * (dep[b] - dep[fa[top[b]]]) / spd;
    dreamin(top[b], tot, tot + co, spd, dep[fa[top[b]]]), b = fa[top[b]],
                                                          tot += co;
  }
  dreamin(top[c], frt, tot, dep[a] < dep[b] ? spd : -spd, dep[a]);
}
int ed[_] = {0};
long double ans = inf;
void make(int x) {
  ed[x] = 1;
  sort(dlq[x].begin(), dlq[x].end(), [](cxk a, cxk b) {
    if (a.st != b.st) return a.st < b.st;
    return a.dir > b.dir;
  });
  multiset<cxk> s;
  for (auto a : dlq[x]) {
    now = a.st;
    if (now >= ans) break;
    if (a.dir) {
      auto b = s.lower_bound(a);
      if (b != s.end()) ans = min(ans, now + cxkdlq(a, *b));
      if (b != s.begin()) b--, ans = min(ans, now + cxkdlq(a, *b));
      s.emplace(a);
    } else {
      swap(a.st, a.ta), s.erase(s.find(a));
      auto b = s.lower_bound(a), c = b;
      if (b != s.begin() && c != s.end())
        b--, ans = min(ans, now + cxkdlq(*b, *c));
    }
  }
}
int main() {
  ios::sync_with_stdio(0), cout.tie(nullptr);
  n = ty(), m = ty();
  for (int i = 1, a, b; i < n; i++) a = ty(), b = ty(), addde(a, b);
  dfs(1, 0), dfs2(1, 1);
  for (int i = 1, a, b, c, d; i <= m; i++)
    a = ty(), b = ty(), c = ty(), d = ty(), pusheen(a, b, c, d);
  for (int i = 1; i <= n; i++)
    if (!ed[top[i]]) make(top[i]);
  if (ans >= inf)
    cout << -1 << lf;
  else
    cout << setprecision(12) << fixed << ans << lf;
  return 0;
}