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 maxn = 1e5 + 10;
const double eps = 1e-9;
inline int O(double x) { return x < -eps ? -1 : (x > eps ? 1 : 0); }
inline int read() {
  int x = 0;
  char c = getchar();
  for (; c < '0' || c > '9'; c = getchar())
    ;
  for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + (c ^ 48);
  return x;
}
int n, m, en, head[maxn];
double T, MXT;
struct edge {
  int v, n;
} e[maxn << 1];
inline void addedge(int u, int v) {
  e[en].v = v;
  e[en].n = head[u];
  head[u] = en++;
  e[en].v = u;
  e[en].n = head[v];
  head[v] = en++;
}
void input() {
  int i;
  n = read();
  m = read();
  en = 2;
  for (i = 1; i < n; i++) addedge(read(), read());
}
int fa[maxn], siz[maxn], son[maxn], top[maxn], dep[maxn];
void dfs(int x, int f) {
  int i;
  siz[x] = 1;
  fa[x] = f;
  for (i = head[x]; i; i = e[i].n)
    if (e[i].v ^ f) {
      dep[e[i].v] = dep[x] + 1;
      dfs(e[i].v, x);
      if (siz[son[x]] < siz[e[i].v]) son[x] = e[i].v;
      siz[x] += siz[e[i].v];
    }
}
void dfs2(int x) {
  int i;
  if (son[x]) top[son[x]] = top[x], dfs2(son[x]);
  for (i = head[x]; i; i = e[i].n)
    if (e[i].v ^ fa[x] && e[i].v ^ son[x]) top[e[i].v] = e[i].v, dfs2(e[i].v);
}
struct li {
  double st, et, sy, dy;
  li() {}
  li(double st, double et, double sy, double dy)
      : st(st), et(et), sy(sy), dy(dy) {}
  bool operator<(const li& s) const {
    return O((sy + (T - st) * dy) - (s.sy + (T - s.st) * s.dy)) < 0;
  }
  double operator*(const li& s) const {
    if (!O(dy - s.dy)) {
      return !O(sy - s.sy) && !O(st - s.st) ? st : 1e200;
    }
    double t = (s.sy - sy + st * dy - s.st * s.dy) / (dy - s.dy);
    return (O(t - max(st, s.st)) >= 0 && O(t - min(et, s.et)) <= 0 ? t : 1e200);
  }
};
vector<li> V[maxn];
inline int lca(int x, int y) {
  while (top[x] ^ top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    x = fa[top[x]];
  }
  return dep[x] < dep[y] ? x : y;
}
void tag(double t, double c, int a, int b) {
  int z = lca(a, b);
  double d = dep[a] + dep[b] - 2 * dep[z];
  while (1) {
    if (top[a] == top[b]) {
      double dis = dep[b] - dep[a];
      V[top[a]].push_back(li(t, t + abs(dis) / c, dep[a], O(dis) * c));
      return;
    }
    if (dep[top[a]] > dep[top[b]]) {
      double dis = dep[fa[top[a]]] - dep[a];
      V[top[a]].push_back(li(t, t + abs(dis) / c, dep[a], O(dis) * c));
      t += abs(dis) / c;
      d -= abs(dis);
      a = fa[top[a]];
    } else {
      double dis = dep[b] - dep[fa[top[b]]];
      V[top[b]].push_back(
          li(t + (d - dis) / c, t + d / c, dep[fa[top[b]]], O(dis) * c));
      d -= abs(dis);
      b = fa[top[b]];
    }
  }
}
inline bool cmpst(const li& a, const li& b) { return a.st < b.st; }
void pre() {
  int i, a, b;
  double t, c;
  dep[1] = 0;
  dfs(1, 0);
  top[1] = 1;
  dfs2(1);
  for (i = 0; i < m; i++)
    t = read(), c = read(), a = read(), b = read(), tag(t, c, a, b);
  for (i = 1; i <= n; i++)
    if (top[i] == i) sort(V[i].begin(), V[i].end(), cmpst);
}
multiset<li> S;
void L_check(int x) {
  int i;
  multimap<double, li> M;
  S.clear();
  M.clear();
  V[x].push_back(li(1e200, 0, 0, 0));
  for (i = 0; i < (int)V[x].size(); i++) {
    while (M.size() && O(M.begin()->first - V[x][i].st) < 0) {
      T = M.begin()->first;
      if (O(T - MXT) >= 0) break;
      multiset<li>::iterator it = S.find(M.begin()->second), pit = it, sit = it;
      assert(it != S.end());
      if (it != S.begin() && (++sit) != S.end())
        MXT = min(MXT, *(--pit) * (*sit));
      S.erase(it);
      M.erase(M.begin());
    }
    T = V[x][i].st;
    if (O(T - MXT) >= 0) break;
    S.insert(V[x][i]);
    multiset<li>::iterator it = S.find(V[x][i]), pit = it, sit = it;
    assert(it != S.end());
    if (it != S.begin()) MXT = min(MXT, *(--pit) * V[x][i]);
    if ((++sit) != S.end()) MXT = min(MXT, *sit * V[x][i]);
    M.insert(make_pair(min(V[x][i].et, MXT), V[x][i]));
  }
}
void solve() {
  MXT = 1e10;
  int i;
  for (i = 1; i <= n; i++)
    if (top[i] == i) {
      L_check(i);
    }
  if (MXT >= 1e10) puts("-1"), exit(0);
  printf("%.6lf\n", MXT);
}
int main() {
  input();
  pre();
  solve();
  return 0;
}