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 = 100005;
const double eps = 1e-9;
int Deep[MAXN], Hfa[MAXN], Fa[MAXN];
int Final[MAXN], To[MAXN * 2], Next[MAXN * 2], Dfn[MAXN], Siz[MAXN], N, M,
    dfn_cnt, tot;
void Link(int u, int v) { To[++tot] = v, Next[tot] = Final[u], Final[u] = tot; }
void Dfs(int Now, int Pre) {
  Siz[Now] = 1;
  for (int i = Final[Now]; i; i = Next[i])
    if (To[i] != Pre) Dfs(To[i], Now), Siz[Now] += Siz[To[i]];
}
void Dfs_H(int Now, int Pre, int Hf) {
  Fa[Now] = Pre, Hfa[Now] = Hf;
  Deep[Now] = Deep[Pre] + 1;
  Dfn[Now] = ++dfn_cnt;
  int h = 0;
  for (int i = Final[Now]; i; i = Next[i])
    if (To[i] != Pre && To[i] != h && Siz[To[i]] > Siz[h]) h = To[i];
  if (h) Dfs_H(h, Now, Hf);
  for (int i = Final[Now]; i; i = Next[i])
    if (To[i] != Pre && To[i] != h) Dfs_H(To[i], Now, To[i]);
}
struct Info {
  int y0, y1, bel;
  Info(void) {}
  Info(int b, int c, int d) : y0(b), y1(c), bel(d) {}
};
struct Line {
  double x, y, x1, k;
  Line(void) {}
  Line(double a, double b, double c, double d) : x(a), y(b), x1(c), k(d) {}
};
vector<Line> SegA[MAXN], Seg;
void Push(double t, double c, int u, int v) {
  static vector<Info> Ro[2];
  for (int i = 0; i < 2; i++) Ro[i].clear();
  for (int cr = 0;;) {
    if (Deep[Hfa[u]] < Deep[Hfa[v]] || Hfa[u] == Hfa[v] && Deep[u] < Deep[v])
      swap(u, v), cr ^= 1;
    if (Hfa[u] != Hfa[v])
      Ro[cr].push_back(Info(Deep[u], Deep[Hfa[u]] - 1, Hfa[u])), u = Fa[Hfa[u]];
    else {
      Ro[cr].push_back(Info(Deep[u], Deep[v], Hfa[u]));
      break;
    }
  }
  for (int i = 0; i < Ro[1].size(); i++) swap(Ro[1][i].y0, Ro[1][i].y1);
  reverse(Ro[1].begin(), Ro[1].end());
  for (int i = 0; i < Ro[1].size(); i++) Ro[0].push_back(Ro[1][i]);
  for (int i = 0; i < Ro[0].size(); i++) {
    int y0 = Ro[0][i].y0, y1 = Ro[0][i].y1;
    double nt = t + abs(y0 - y1) / c;
    SegA[Ro[0][i].bel].push_back(Line(t, y0, nt, (y0 < y1) ? c : -c));
    t = nt;
  }
}
bool cmp(pair<double, int> a, pair<double, int> b) {
  return a.first < b.first ||
         fabs(a.first - b.first) < eps && (a.second & 1) < (b.second & 1);
}
double CurX;
struct Cmp {
  bool operator()(int a, int b) const {
    double y0 = Seg[a].y + (CurX - Seg[a].x) * Seg[a].k,
           y1 = Seg[b].y + (CurX - Seg[b].x) * Seg[b].k;
    return y0 - y1 < -eps || (fabs(y0 - y1) <= eps && a < b);
  }
};
double ans;
set<int, Cmp> Sav;
bool In(double a, Line b) { return (a - b.x > -eps && b.x1 - a > -eps); }
double Calc(Line a, Line b) {
  double k1 = a.k, b1 = a.y - k1 * a.x, k2 = b.k, b2 = b.y - k2 * b.x, tmp;
  if (fabs(k1 - k2) <= eps) {
    if (fabs(b1 - b2) > eps) return 1e100;
    tmp = max(a.x, b.x);
  } else
    tmp = (b2 - b1) / (k1 - k2);
  if (!In(tmp, a) || !In(tmp, b)) return 1e100;
  return tmp;
}
void Work(int S) {
  static vector<pair<double, int> > All;
  All.clear();
  Seg = SegA[S];
  for (int i = 0; i < Seg.size(); i++) {
    All.push_back(make_pair(Seg[i].x, i << 1));
    All.push_back(make_pair(Seg[i].x1, i << 1 | 1));
  }
  sort(All.begin(), All.end(), cmp);
  Sav.clear();
  for (int i = 0; i < All.size(); i++) {
    pair<double, int> cr = All[i];
    CurX = cr.first;
    if (CurX >= ans || fabs(CurX - ans) <= eps) break;
    int ref = (cr.second >> 1);
    if (cr.second & 1) {
      set<int, Cmp>::iterator it = Sav.find(ref), ix, iy;
      ix = it, iy = it;
      ++iy;
      if (ix != Sav.begin()) {
        ix--;
        if (iy != Sav.end()) ans = min(ans, Calc(Seg[*ix], Seg[*iy]));
      }
      Sav.erase(it);
    } else {
      Sav.insert(ref);
      set<int, Cmp>::iterator it = Sav.find(ref), ix, iy;
      ix = it, iy = it;
      ++iy;
      if (ix != Sav.begin()) {
        ix--;
        ans = min(ans, Calc(Seg[*ix], Seg[*it]));
      }
      if (iy != Sav.end()) ans = min(ans, Calc(Seg[*it], Seg[*iy]));
    }
  }
}
int main() {
  scanf("%d%d", &N, &M);
  for (int i = 1, u, v; i < N; i++) {
    scanf("%d%d", &u, &v);
    Link(u, v), Link(v, u);
  }
  Dfs(1, 0);
  Dfs_H(1, 0, 1);
  for (int i = 1; i <= M; i++) {
    int t, c, u, v;
    scanf("%d%d%d%d", &t, &c, &u, &v);
    Push(t, c, u, v);
  }
  ans = 1e100;
  for (int i = 1; i <= N; i++)
    if (Hfa[i] == i) Work(i);
  if (ans > 1e10)
    printf("-1\n");
  else
    printf("%.10f\n", ans);
  return 0;
}