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 double inf = 1e9;
const double eps = 1e-9;
inline int gi() {
  int w = 0, q = 0;
  char c = getchar();
  while ((c < '0' || c > '9') && (c != '-')) c = getchar();
  if (c == '-') q = 1, c = getchar();
  while (c >= '0' && c <= '9') w = w * 10 + c - '0', c = getchar();
  return q ? -w : w;
}
bool vis[210000];
double T, ans, c[210000], ed[210000];
int n, m, tot;
int head[210000], nxt[(210000 << 1)], to[(210000 << 1)];
int t[210000], d[210000], fa[210000], sz[210000], tp[210000], son[210000];
void link(int x, int y) { nxt[tot] = head[x], to[tot] = y, head[x] = tot++; }
void dfs(int x) {
  sz[x] = 1;
  for (int i = head[x]; i != -1; i = nxt[i]) {
    int v = to[i];
    if (v == fa[x]) continue;
    fa[v] = x, d[v] = d[x] + 1, dfs(v), sz[x] += sz[v];
    if (sz[v] > sz[son[x]]) son[x] = v;
  }
}
void dfs1(int x, int top) {
  tp[x] = top;
  if (son[x]) dfs1(son[x], top);
  for (int i = head[x]; i != -1; i = nxt[i]) {
    int v = to[i];
    if (v == fa[x] || v == son[x]) continue;
    dfs1(v, v);
  }
}
double tim(int x, int y, double v) { return (double)(d[x] - d[y]) / v; }
struct data {
  int x;
  double y;
  int k;
  double C;
  int f;
  friend bool operator<(const data &a, const data &b) {
    return (1.0 * d[a.x] + (T - a.y) * c[a.k]) <
           (1.0 * d[b.x] + (T - b.y) * c[b.k]);
  }
} st[210000];
double pos(data a) { return 1.0 * d[a.x] + (T - a.y) * 1.0 * c[a.k]; }
bool cmp(data a, data b) {
  return fabs(a.y - b.y) < eps ? a.f > b.f : a.y < b.y;
}
vector<data> f[210000];
multiset<data> s;
multiset<data>::iterator it, is;
void get(data x, data y) {
  double X = (pos(y) - pos(x)) / (c[x.k] - c[y.k]);
  if (fabs(pos(y) - pos(x)) < eps) X = 0;
  if (X > -eps && X + T < min(ed[x.k], ed[y.k]) + eps) ans = min(ans, X + T);
}
void work(int x) {
  vis[x] = 1;
  s.clear();
  sort(f[x].begin(), f[x].end(), cmp);
  for (int i = 0; i < f[x].size(); ++i) {
    if (!f[x][i].f)
      ed[f[x][i].k] = f[x][i].y;
    else
      st[f[x][i].k] = f[x][i];
  }
  for (int i = 0; i < f[x].size(); ++i) {
    data k = f[x][i];
    T = k.y;
    if (T >= ans) break;
    if (k.f) {
      it = s.insert(k);
      c[k.k] = k.C;
      if (it != s.begin()) --it, get(k, (*it)), ++it;
      if (++it != s.end()) get(k, (*it));
    } else {
      it = s.find(st[k.k]);
      if (it != s.begin()) {
        is = it, is--, it++;
        if (it != s.end() && it != is) get((*is), (*it));
        it--;
      }
      if (it != s.end()) s.erase(it);
    }
  }
}
int main() {
  n = gi(), m = gi();
  int x, y, u, v, lca;
  memset(head, -1, sizeof(head));
  for (int i = 1; i < n; ++i) x = gi(), y = gi(), link(x, y), link(y, x);
  dfs(1), dfs1(1, 1);
  for (int i = 1; i <= m; ++i) {
    t[i] = gi(), scanf("%lf", &c[i]), u = gi(), v = gi();
    x = u, y = v;
    while (tp[x] != tp[y]) {
      if (d[tp[x]] < d[tp[y]]) swap(x, y);
      x = fa[tp[x]];
    }
    if (d[x] > d[y]) swap(x, y);
    lca = x;
    x = u, y = v;
    double tmp = t[i] + tim(u, lca, c[i]);
    bool ty = 1;
    while (tp[x] != tp[y]) {
      if (d[tp[x]] < d[tp[y]]) swap(x, y), ty ^= 1;
      if (ty) {
        f[tp[x]].push_back((data){x, t[i] + tim(u, x, c[i]), i, -c[i], 1});
        f[tp[x]].push_back(
            (data){fa[tp[x]], t[i] + tim(u, fa[tp[x]], c[i]), i, -c[i], 0});
      } else {
        f[tp[x]].push_back(
            (data){fa[tp[x]], tmp + tim(fa[tp[x]], lca, c[i]), i, c[i], 1});
        f[tp[x]].push_back((data){x, tmp + tim(x, lca, c[i]), i, c[i], 0});
      }
      x = fa[tp[x]];
    }
    if (d[x] < d[y]) swap(x, y), ty ^= 1;
    if (ty) {
      f[tp[x]].push_back((data){x, t[i] + tim(u, x, c[i]), i, -c[i], 1});
      f[tp[x]].push_back((data){y, t[i] + tim(u, y, c[i]), i, -c[i], 0});
    } else {
      f[tp[x]].push_back((data){y, tmp, i, c[i], 1});
      f[tp[x]].push_back((data){x, tmp + tim(x, y, c[i]), i, c[i], 0});
    }
  }
  ans = inf;
  for (int i = 1; i <= n; ++i)
    if (!vis[tp[i]]) work(tp[i]);
  if (fabs(ans - inf) < 1e3)
    puts("-1");
  else
    printf("%.6lf\n", ans);
  return 0;
}