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, eps = 1e-7;
int n, m, vis[150005], t[150005];
int d[150005], fa[150005], tot[150005], tp[150005], son[150005];
double T, ans, c[150005], ed[150005];
double tim(int x, int y, double v) { return (double)(d[x] - d[y]) / v; }
struct Node {
  int y, next;
} a[300005];
int len = 0, last[300005];
void ins(int x, int y) {
  a[++len].y = y;
  a[len].next = last[x];
  last[x] = len;
}
void pre(int x) {
  tot[x] = 1;
  int y;
  for (int i = last[x]; i; i = a[i].next)
    if ((y = a[i].y) != fa[x]) {
      fa[y] = x;
      d[y] = d[x] + 1;
      pre(y);
      tot[x] += tot[y];
      son[x] = tot[y] > tot[son[x]] ? y : son[x];
    }
}
void dfs(int x, int top) {
  tp[x] = top;
  int y;
  if (son[x]) dfs(son[x], top);
  for (int i = last[x]; i; i = a[i].next)
    if ((y = a[i].y) != fa[x] && y != son[x]) dfs(y, y);
}
struct node {
  int x;
  double y;
  int k;
  double C;
  int f;
} s[150005];
double ps(node a) { return 1.0 * d[a.x] + 1.0 * (T - a.y) * c[a.k]; }
bool cmp(node a, node b) {
  return fabs(a.y - b.y) < eps ? a.f > b.f : a.y < b.y;
}
bool operator<(node a, node b) { return ps(a) < ps(b); }
vector<node> f[150005];
multiset<node> S;
multiset<node>::iterator t1, t2;
void gt(node x, node y) {
  double p = (ps(y) - ps(x)) / (c[x.k] - c[y.k]);
  if (fabs(ps(y) - ps(x)) < eps) p = 0;
  if (p + eps > 0 && p + T < min(ed[x.k], ed[y.k]) + eps) ans = min(ans, p + T);
}
inline void sol(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)
      s[f[x][i].k] = f[x][i];
    else
      ed[f[x][i].k] = f[x][i].y;
  for (int i = 0; i < f[x].size(); i++) {
    node t = f[x][i];
    T = t.y;
    if (T >= ans) break;
    if (t.f) {
      t1 = S.insert(t);
      c[t.k] = t.C;
      if (t1 != S.begin()) t1--, gt(t, (*t1)), t1++;
      t1++;
      if (t1 != S.end()) gt(t, (*t1));
    } else {
      t1 = S.find(s[t.k]);
      if (t1 != S.begin()) {
        t2 = t1;
        t2--;
        t1++;
        if (t1 != S.end() && t1 != t2) gt((*t2), (*t1));
        t1--;
      }
      if (t1 != S.end()) S.erase(t1);
    }
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1, x, y; i < n; i++)
    scanf("%d %d", &x, &y), ins(x, y), ins(y, x);
  pre(1);
  dfs(1, 1);
  for (int i = 1, u, v; i <= m; i++) {
    scanf("%d %lf %d %d", &t[i], &c[i], &u, &v);
    int x = u, y = v, lca;
    for (; tp[x] != tp[y]; x = fa[tp[x]])
      if (d[tp[x]] < d[tp[y]]) swap(x, y);
    if (d[x] > d[y]) swap(x, y);
    lca = x;
    x = u;
    y = v;
    double tt = t[i] + tim(u, lca, c[i]);
    int ff = 1;
    for (; tp[x] != tp[y]; x = fa[tp[x]]) {
      if (d[tp[x]] < d[tp[y]]) swap(x, y), ff ^= 1;
      if (ff) {
        f[tp[x]].push_back((node){x, t[i] + tim(u, x, c[i]), i, -c[i], 1});
        f[tp[x]].push_back(
            (node){fa[tp[x]], t[i] + tim(u, fa[tp[x]], c[i]), i, -c[i], 0});
      } else {
        f[tp[x]].push_back(
            (node){fa[tp[x]], tt + tim(fa[tp[x]], lca, c[i]), i, c[i], 1});
        f[tp[x]].push_back((node){x, tt + tim(x, lca, c[i]), i, c[i], 0});
      }
    }
    if (d[x] < d[y]) swap(x, y), ff ^= 1;
    if (ff) {
      f[tp[x]].push_back((node){x, t[i] + tim(u, x, c[i]), i, -c[i], 1});
      f[tp[x]].push_back((node){y, tt, i, -c[i], 0});
    } else {
      f[tp[x]].push_back((node){y, tt, i, c[i], 1});
      f[tp[x]].push_back((node){x, tt + tim(x, y, c[i]), i, c[i], 0});
    }
  }
  ans = inf;
  for (int i = 1; i <= n; i++)
    if (!vis[tp[i]]) sol(tp[i]);
  if (fabs(ans - inf) < 1)
    puts("-1");
  else
    printf("%.6lf\n", ans);
  return 0;
}