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) {
  char ch;
  x = 0;
  bool fl = false;
  while (!isdigit(ch = getchar())) (ch == '-') && (fl = true);
  for (x = (ch ^ '0'); isdigit(ch = getchar()); x = x * 10 + (ch ^ '0'))
    ;
  (fl == true) && (x = -x);
}
template <class T>
inline void output(T x) {
  if (x / 10) output(x / 10);
  putchar(x % 10 + '0');
}
template <class T>
inline void ot(T x) {
  if (x < 0) putchar('-'), x = -x;
  output(x);
  putchar(' ');
}
template <class T>
inline void prt(T a[], int st, int nd) {
  for (register int i = st; i <= nd; ++i) ot(a[i]);
  putchar('\n');
}
namespace Modulo {
const int mod = 998244353;
inline int ad(int x, int y) { return x + y >= mod ? x + y - mod : x + y; }
inline int sub(int x, int y) { return ad(x, mod - y); }
inline int mul(int x, int y) { return (long long)x * y % mod; }
inline void inc(int &x, int y) { x = ad(x, y); }
inline void inc2(int &x, int y) { x = mul(x, y); }
inline int qm(int x, int y = mod - 2) {
  int ret = 1;
  while (y) {
    if (y & 1) ret = mul(x, ret);
    x = mul(x, x);
    y >>= 1;
  }
  return ret;
}
template <class... Args>
inline int ad(const int a, const int b, const Args &...args) {
  return ad(ad(a, b), args...);
}
template <class... Args>
inline int mul(const int a, const int b, const Args &...args) {
  return mul(mul(a, b), args...);
}
}  // namespace Modulo
namespace Miracle {
const int N = 1e5 + 5;
const double inf = 1e13;
const double eps = 1e-9;
int n, m;
struct node {
  int nxt, to;
} eg[2 * N];
int hd[N], cnt;
void add(int x, int y) {
  eg[++cnt].nxt = hd[x];
  eg[cnt].to = y;
  hd[x] = cnt;
}
int dfn[N], df, top[N], fa[N], id[N];
int son[N], sz[N], dep[N];
double X;
int Fabs(double x) {
  if (x > eps) return 1;
  if (x < -eps) return -1;
  return 0;
}
struct line {
  int st, nd;
  double bt, v;
  double friend operator&(line x, line y) {
    if (Fabs(x.v - y.v)) {
      double ny = y.st + (x.bt - y.bt) * y.v;
      double tim = x.bt + (ny - x.st) / (x.v - y.v);
      if (tim > y.bt - eps && tim > x.bt - eps &&
          tim < y.bt + (y.nd - y.st) / y.v + eps &&
          tim < x.bt + (x.nd - x.st) / x.v + eps)
        return tim;
      return inf;
    } else {
      if (Fabs((y.st - x.st) / x.v + x.bt - y.bt) == 0) return max(y.bt, x.bt);
      return inf;
    }
  }
  bool friend operator<(line x, line y) {
    double nx = x.st + (X - x.bt) * x.v, ny = y.st + (X - y.bt) * y.v;
    if (Fabs(nx - ny) != 0) return nx < ny;
    if (Fabs(x.v - y.v) != 0) return x.v < y.v;
    if (x.st != y.st) return x.st < y.st;
    return x.nd < y.nd;
  }
};
struct hl {
  vector<line> mem;
  int st, nd;
} h[N];
int tot;
void dfs(int x) {
  sz[x] = 1;
  dep[x] = dep[fa[x]] + 1;
  for (register int i = hd[x]; i; i = eg[i].nxt) {
    int y = eg[i].to;
    if (y == fa[x]) continue;
    fa[y] = x;
    dfs(y);
    sz[x] += sz[y];
    if (sz[y] > sz[son[x]]) son[x] = y;
  }
}
void dfs2(int x) {
  dfn[x] = ++df;
  if (!top[x]) {
    ++tot;
    if (x == 1)
      h[tot].st = x;
    else
      h[tot].st = fa[x];
    top[x] = x;
    id[x] = tot;
    h[tot].nd = x;
  } else {
    id[x] = id[top[x]];
    h[id[x]].nd = x;
  }
  if (son[x]) top[son[x]] = top[x], dfs2(son[x]);
  for (register int i = hd[x]; i; i = eg[i].nxt) {
    int y = eg[i].to;
    if (y == fa[x]) continue;
    if (y == son[x]) continue;
    dfs2(y);
  }
}
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]];
  }
  if (dep[x] < dep[y]) swap(x, y);
  return y;
}
void push(int x, int y, int t, int c) {
  double xt = t;
  int anc = lca(x, y);
  int dis = dep[x] + dep[y] - 2 * dep[anc];
  double yt = (double)t + (double)dis / c;
  while (top[x] != top[y]) {
    if (dep[top[x]] > dep[top[y]]) {
      int now = id[x];
      line lp;
      lp.bt = xt;
      lp.st = dep[x] - dep[h[now].st];
      lp.nd = 0;
      lp.v = -c;
      h[now].mem.push_back(lp);
      xt += (double)(dep[x] - dep[h[now].st]) / c;
      x = fa[top[x]];
    } else {
      int now = id[y];
      line lp;
      yt -= (double)(dep[y] - dep[h[now].st]) / c;
      lp.bt = yt;
      lp.st = 0;
      lp.nd = dep[y] - dep[h[now].st];
      lp.v = c;
      h[now].mem.push_back(lp);
      y = fa[top[y]];
    }
  }
  if (dep[x] > dep[y]) {
    int now = id[x];
    line lp;
    lp.bt = xt;
    lp.st = dep[x] - dep[h[now].st];
    lp.nd = dep[y] - dep[h[now].st];
    lp.v = -c;
    h[now].mem.push_back(lp);
  } else {
    int now = id[y];
    line lp;
    yt -= (double)(dep[y] - dep[x]) / c;
    lp.bt = yt;
    lp.st = dep[x] - dep[h[now].st];
    lp.nd = dep[y] - dep[h[now].st];
    lp.v = c;
    h[now].mem.push_back(lp);
  }
}
double ans = inf;
struct ev {
  double p;
  int id, tp;
  bool friend operator<(ev a, ev b) {
    if (Fabs(a.p - b.p) != 0) return a.p < b.p;
    return a.tp > b.tp;
  }
} e[2 * N];
multiset<line> s;
int main() {
  rd(n);
  rd(m);
  int x, y;
  for (register int i = 1; i < n; ++i) {
    rd(x);
    rd(y);
    add(x, y);
    add(y, x);
  }
  dfs(1);
  dfs2(1);
  int t, c;
  for (register int i = 1; i <= m; ++i) {
    rd(t);
    rd(c);
    rd(x);
    rd(y);
    push(x, y, t, c);
  }
  ans = inf;
  for (register int i = 1; i <= tot; ++i) {
    int num = 0;
    for (register int o = 0; o < (int)h[i].mem.size(); ++o) {
      line lp = h[i].mem[o];
      e[++num].id = o;
      e[num].p = lp.bt;
      e[num].tp = 1;
      e[++num].id = o;
      e[num].p = lp.bt + (lp.nd - lp.st) / lp.v;
      e[num].tp = -1;
    }
    sort(e + 1, e + num + 1);
    s.clear();
    for (register int j = 1; j <= num; ++j) {
      X = e[j].p;
      if (X > ans - eps) break;
      line lp = h[i].mem[e[j].id];
      if (e[j].tp == 1) {
        s.insert(lp);
        auto bc = s.lower_bound(lp);
        auto tmp = bc;
        ++tmp;
        if (tmp != s.end()) {
          ans = min(ans, (*tmp) & lp);
        }
        tmp = bc;
        if (tmp != s.begin()) {
          --tmp;
          ans = min(ans, (*tmp) & lp);
        }
      } else {
        auto bc = s.lower_bound(lp);
        if (bc != s.end()) {
          if (bc != s.begin()) {
            auto pr = bc;
            --pr;
            ans = min(ans, (*bc) & (*pr));
          }
        }
        auto now = s.find(lp);
        s.erase(now);
      }
    }
  }
  if (ans >= inf - 1)
    puts("-1");
  else
    printf("%.10lf", ans);
  return 0;
}
}  // namespace Miracle
signed main() {
  Miracle::main();
  return 0;
}