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>
inline int read() {
  char c = getchar();
  int x = 0, ft = 1;
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') ft = -1;
  for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  return x * ft;
}
struct Frac {
  long long x, y;
  Frac() {}
  Frac(long long xx) : x(xx), y(1) {}
  Frac(long long xx, long long yy) {
    x = xx;
    y = yy;
    if (y < 0) x = -x, y = -y;
  }
  friend bool operator<(Frac a, Frac b) { return a.x * b.y < a.y * b.x; }
  friend bool operator==(Frac a, Frac b) { return a.x * b.y == a.y * b.x; }
  friend Frac operator*(int a, Frac b) { return Frac(b.x * a, b.y); }
  friend Frac operator+(Frac a, Frac b) {
    if (a.y == b.y) return Frac(a.x + b.x, a.y);
    return Frac(a.x * b.y + b.x * a.y, a.y * b.y);
  }
};
const int N = 1e5 + 5;
int n, m;
std::vector<int> g[N];
int d[N], fa[N], sz[N], son[N], top[N];
void dfs1(int u, int pre) {
  d[u] = d[pre] + 1;
  fa[u] = pre;
  sz[u] = 1;
  for (auto v : g[u])
    if (v != fa[u]) {
      dfs1(v, u);
      sz[u] += sz[v];
      if (!son[u] || sz[v] > sz[son[u]]) son[u] = v;
    }
}
void dfs2(int u, int pre) {
  top[u] = pre;
  if (son[u]) dfs2(son[u], pre);
  for (auto v : g[u])
    if (v != fa[u] && v != son[u]) dfs2(v, v);
}
inline int dist(int x, int y) {
  int res = d[x] + d[y];
  while (top[x] ^ top[y]) {
    if (d[top[x]] < d[top[y]]) std::swap(x, y);
    x = fa[top[x]];
  }
  return res - 2 * std::min(d[x], d[y]);
}
int cnt, qk[N * 20], qb[N * 20];
Frac ql[N * 20], qr[N * 20];
std::vector<int> G[N];
inline void add_seg(int x, int y, int t, int c) {
  int dx = 0, dy = dist(x, y);
  t *= c;
  while (top[x] ^ top[y]) {
    ++cnt;
    if (d[top[x]] > d[top[y]]) {
      ql[cnt] = Frac(t + dx, c);
      dx += d[x] - d[top[x]] + 1;
      qr[cnt] = Frac(t + dx, c);
      qk[cnt] = -c;
      qb[cnt] = dx + t;
      G[top[x]].push_back(-cnt);
      G[top[x]].push_back(cnt);
      x = fa[top[x]];
    } else {
      qr[cnt] = Frac(t + dy, c);
      dy -= d[y] - d[top[y]] + 1;
      ql[cnt] = Frac(t + dy, c);
      qk[cnt] = c;
      qb[cnt] = -dy - t;
      G[top[y]].push_back(-cnt);
      G[top[y]].push_back(cnt);
      y = fa[top[y]];
    }
  }
  ++cnt;
  ql[cnt] = Frac(t + dx, c);
  qr[cnt] = Frac(t + dy, c);
  if (d[x] < d[y]) {
    qk[cnt] = c;
    qb[cnt] = -dx - t + d[x] - d[top[x]] + 1;
  } else {
    qk[cnt] = -c;
    qb[cnt] = dx + t + d[x] - d[top[x]] + 1;
  }
  G[top[x]].push_back(-cnt);
  G[top[x]].push_back(cnt);
}
double ans;
Frac T;
struct cmp {
  bool operator()(int a, int b) {
    Frac fa = qk[a] * T + qb[a], fb = qk[b] * T + qb[b];
    if (fa == fb) return a < b;
    return fa < fb;
  }
};
std::set<int, cmp> S;
void solve(int u) {
  std::sort(G[u].begin(), G[u].end(), [&](int a, int b) {
    Frac xa = a < 0 ? ql[-a] : qr[a], xb = b < 0 ? ql[-b] : qr[b];
    if (xa == xb) return a < b;
    return xa < xb;
  });
  S.clear();
  int fg = 0;
  Frac sec;
  auto check = [&](int a, int b) {
    Frac lx = std::max(ql[a], ql[b]);
    Frac rx = std::min(qr[a], qr[b]);
    if (qk[a] == qk[b]) {
      if (qb[a] != qb[b]) return;
      if (!fg)
        fg = 1, sec = lx;
      else
        sec = std::min(sec, lx);
    } else {
      Frac sx(qb[a] - qb[b], qk[b] - qk[a]);
      if (sx < lx || rx < sx) return;
      if (!fg)
        fg = 1, sec = sx;
      else
        sec = std::min(sec, sx);
    }
  };
  for (auto id : G[u]) {
    T = id < 0 ? ql[-id] : qr[id];
    if (fg && !(T < sec)) break;
    if (id < 0) {
      id = -id;
      auto it = S.insert(id).first;
      auto pre = it, nex = it;
      if (pre == S.begin())
        pre = S.end();
      else
        --pre;
      ++nex;
      if (pre != S.end()) check(id, *pre);
      if (nex != S.end()) check(id, *nex);
    } else {
      auto it = S.erase(S.find(id));
      if (it == S.end() || it == S.begin()) continue;
      auto pre = it;
      --pre;
      check(*it, *pre);
    }
  }
  if (fg) ans = std::min(ans, sec.x / (double)sec.y);
}
int main() {
  n = read();
  m = read();
  ans = 1e99;
  for (int i = 1, u, v; i < n; ++i) {
    u = read();
    v = read();
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs1(1, 0);
  dfs2(1, 1);
  for (int i = 1, t, c, u, v; i <= m; ++i) {
    t = read();
    c = read();
    u = read();
    v = read();
    add_seg(u, v, t, c);
  }
  for (int u = 1; u <= n; ++u)
    if (u == top[u]) solve(u);
  if (ans > 1e98)
    puts("-1");
  else
    printf("%.10lf\n", ans);
  return 0;
}