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 std::max;
using std::min;
const int inf = 0x3f3f3f3f, Inf = 0x7fffffff;
const long long INF = 0x3f3f3f3f3f3f3f3f;
std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());
template <typename _Tp>
_Tp gcd(const _Tp &a, const _Tp &b) {
  return (!b) ? a : gcd(b, a % b);
}
template <typename _Tp>
inline _Tp abs(const _Tp &a) {
  return a >= 0 ? a : -a;
}
template <typename _Tp>
inline void chmax(_Tp &a, const _Tp &b) {
  (a < b) && (a = b);
}
template <typename _Tp>
inline void chmin(_Tp &a, const _Tp &b) {
  (b < a) && (a = b);
}
template <typename _Tp>
inline void read(_Tp &x) {
  char ch(getchar());
  bool f(false);
  while (!isdigit(ch)) f |= ch == 45, ch = getchar();
  x = ch & 15, ch = getchar();
  while (isdigit(ch)) x = (((x << 2) + x) << 1) + (ch & 15), ch = getchar();
  f && (x = -x);
}
template <typename _Tp, typename... Args>
inline void read(_Tp &t, Args &...args) {
  read(t);
  read(args...);
}
inline int read_str(char *s) {
  char ch(getchar());
  while (ch == ' ' || ch == '\r' || ch == '\n') ch = getchar();
  char *tar = s;
  *tar = ch, ch = getchar();
  while (ch != ' ' && ch != '\r' && ch != '\n' && ch != EOF)
    *(++tar) = ch, ch = getchar();
  return tar - s + 1;
}
const int N = 100005;
const double eps = 1e-8;
struct edge {
  int v, nxt;
} c[N << 1];
int front[N], edge_cnt;
inline void addedge(int u, int v) {
  c[++edge_cnt] = (edge){v, front[u]};
  front[u] = edge_cnt;
}
int dep[N], Fa[N], siz[N], son[N], top[N];
void dfs1(int x, int fa) {
  dep[x] = dep[fa] + 1, Fa[x] = fa, siz[x] = 1;
  for (int i = front[x]; i; i = c[i].nxt) {
    int v = c[i].v;
    if (v == fa) continue;
    dfs1(v, x), siz[x] += siz[v];
    if (siz[v] > siz[son[x]]) son[x] = v;
  }
}
void dfs2(int x, int topf) {
  top[x] = topf;
  if (!son[x]) return;
  dfs2(son[x], topf);
  for (int i = front[x]; i; i = c[i].nxt)
    if (!top[c[i].v]) dfs2(c[i].v, c[i].v);
}
int lca(int x, int y) {
  while (top[x] != top[y]) {
    if (dep[top[x]] > dep[top[y]])
      x = Fa[top[x]];
    else
      y = Fa[top[y]];
  }
  return dep[x] < dep[y] ? x : y;
}
double now;
struct info {
  double s, t, c, u;
  inline bool operator<(const info &o) const {
    return u + (now - s) * c < o.u + (now - o.s) * o.c;
  }
};
std::vector<info> H[N], L[N];
inline info trans(double s, int c, int u, int v) {
  if (u <= v)
    return {s, (double)(v - u) / c + s, (double)c, (double)u};
  else
    return {s, (double)(u - v) / c + s, -(double)c, (double)u};
}
void push(int x, int y, int t, int c) {
  int c1 = 0, c2 = 0, len = dep[x] + dep[y] - (dep[lca(x, y)] << 1);
  while (top[x] != top[y]) {
    if (dep[top[x]] > dep[top[y]]) {
      H[top[x]].push_back(
          trans((double)c1 / c + t, c, dep[x] - dep[top[x]], 0));
      c1 += dep[x] - dep[top[x]], x = top[x];
      L[x].push_back(trans((double)c1 / c + t, c, 0, 1));
      ++c1, x = Fa[x];
    } else {
      c2 += dep[y] - dep[top[y]];
      H[top[y]].push_back(
          trans((double)(len - c2) / c + t, c, 0, dep[y] - dep[top[y]]));
      y = top[y], ++c2;
      L[y].push_back(trans((double)(len - c2) / c + t, c, 1, 0));
      y = Fa[y];
    }
  }
  if (dep[x] <= dep[y])
    H[top[x]].push_back(trans((double)c1 / c + t, c, dep[x] - dep[top[x]],
                              dep[y] - dep[top[y]]));
  else
    H[top[y]].push_back(trans((double)c1 / c + t, c, dep[x] - dep[top[x]],
                              dep[y] - dep[top[y]]));
}
double ans = 1e18;
std::multiset<info> S;
void calc(const info &a, const info &b) {
  double x;
  if (abs(a.c - b.c) <= eps) {
    if (abs((a.u - a.s * a.c) - (b.u - b.s * b.c)) <= eps)
      x = max(a.s, b.s);
    else
      return;
  } else
    x = (double)(b.u - a.u + a.s * a.c - b.s * b.c) / (a.c - b.c);
  if (x >= a.s && x <= a.t && x >= b.s && x <= b.t) chmin(ans, x);
}
struct eve {
  double s;
  info o;
  int opt;
  inline bool operator<(const eve &o) const { return s < o.s; }
};
void solve(std::vector<info> o) {
  S.clear();
  std::vector<eve> v;
  for (auto it : o)
    v.push_back({it.s, it, 1}), v.push_back({it.t + 5 * eps, it, -1});
  std::sort(v.begin(), v.end());
  for (auto cur : v) {
    if (cur.s >= ans - eps) return;
    now = cur.s;
    if (cur.opt == 1) {
      auto it = S.insert(cur.o);
      if (it != S.begin()) {
        auto tmp = it;
        calc(*--tmp, *it);
      }
      if (++it != S.end()) {
        auto tmp = it;
        calc(*--tmp, *it);
      }
    } else {
      auto it = S.find(cur.o);
      if (it != S.begin() && ++it != S.end()) {
        auto tmp = it;
        calc(*--(--tmp), *it);
      }
      S.erase(S.find(cur.o));
    }
  }
}
int main() {
  int n, m;
  read(n, m);
  int t, c, x, y;
  for (int i = 1; i < n; ++i) read(x, y), addedge(x, y), addedge(y, x);
  dfs1(1, 0), dfs2(1, 1);
  while (m--) read(t, c, x, y), push(x, y, t, c);
  for (int i = 1; i <= n; ++i) solve(H[i]), solve(L[i]);
  if (ans > 1e17)
    puts("-1");
  else
    printf("%.12lf\n", ans);
  return 0;
}