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;
bool cmp(double p, double q) { return p + 1e-12 > q && p - 1e-12 < q; }
const int _ = 1e5 + 7;
struct Edge {
  int end, upEd;
} Ed[_ << 1];
int head[_], cntEd, N, M;
void addEd(int a, int b) {
  Ed[++cntEd] = (Edge){b, head[a]};
  head[a] = cntEd;
}
int top[_], sz[_], son[_], dep[_], dfn[_], fa[_], ts;
void dfs1(int x, int p) {
  sz[x] = 1;
  dep[x] = dep[p] + 1;
  fa[x] = p;
  for (int i = head[x]; i; i = Ed[i].upEd)
    if (Ed[i].end != p) {
      dfs1(Ed[i].end, x);
      sz[x] += sz[Ed[i].end];
      if (sz[son[x]] < sz[Ed[i].end]) son[x] = Ed[i].end;
    }
}
void dfs2(int x, int t) {
  top[x] = t;
  dfn[x] = ++ts;
  if (!son[x]) return;
  dfs2(son[x], t);
  for (int i = head[x]; i; i = Ed[i].upEd)
    if (Ed[i].end != fa[x] && Ed[i].end != son[x]) dfs2(Ed[i].end, Ed[i].end);
}
int dist(int x, int y) {
  int sum = 0;
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    sum += dep[x] - dep[top[x]] + 1;
    x = fa[top[x]];
  }
  return sum + max(dep[x], dep[y]) - min(dep[x], dep[y]);
}
struct comp {
  double x, y;
  comp(double _x = 0, double _y = 0) : x(_x), y(_y) {}
  friend comp operator+(comp p, comp q) { return comp(p.x + q.x, p.y + q.y); }
  friend comp operator-(comp p, comp q) { return comp(p.x - q.x, p.y - q.y); }
  friend double operator*(comp p, comp q) { return p.x * q.x + p.y * q.y; }
  friend double operator%(comp p, comp q) { return p.x * q.y - p.y * q.x; }
  friend comp operator*(comp p, double q) { return comp(p.x * q, p.y * q); }
};
double mnsect, cur;
struct line {
  double x1, y1, x2, y2;
  bool f1, f2;
  line(double _x1 = 0, double _y1 = 0, double _x2 = 0, double _y2 = 0,
       bool _f1 = 0, bool _f2 = 0)
      : x1(_x1), y1(_y1), x2(_x2), y2(_y2), f1(_f1), f2(_f2) {}
  double calc(double pos) {
    return cmp(x1, x2) ? y1 : y1 + (pos - x1) / (x2 - x1) * (y2 - y1);
  }
  friend bool operator<(line p, line q) {
    if (!cmp(p.calc(cur), q.calc(cur))) return p.calc(cur) < q.calc(cur);
    if (!cmp(p.x1, q.x1)) return p.x1 < q.x1;
    if (!cmp(p.x2, q.x2)) return p.x2 < q.x2;
    if (!cmp(p.y1, q.y1)) return p.y1 < q.y1;
    if (!cmp(p.y2, q.y2)) return p.y2 < q.y2;
    return 0;
  }
};
vector<line> now;
set<line> in;
void getsect(line p, line q) {
  comp st1(p.x1, p.y1), ed1(p.x2, p.y2), st2(q.x1, q.y1), ed2(q.x2, q.y2);
  if (((st2 - st1) % (ed1 - st1)) * ((ed2 - st1) % (ed1 - st1)) > 1e-12) return;
  if (((st1 - st2) % (ed2 - st2)) * ((ed1 - st2) % (ed2 - st2)) > 1e-12) return;
  double ar = (st1 - ed1) % (st2 - ed2);
  if (cmp(ar, 0)) {
    if ((p.f2 || !cmp(cur, p.x2)) && (q.f2 || !cmp(cur, q.x2)))
      mnsect = min(mnsect, cur);
    return;
  }
  double pr = abs(((st1 - st2) % (ed2 - st2)) / ar);
  comp now = st1 + (ed1 - st1) * pr;
  if ((cmp(now.x, st1.x) && !p.f1) || (cmp(now.x, ed1.x) && !p.f2)) return;
  if ((cmp(now.x, st2.x) && !q.f1) || (cmp(now.x, ed2.x) && !q.f2)) return;
  mnsect = min(mnsect, now.x);
}
int main() {
  cin >> N >> M;
  for (int x, y, i = 1; i < N; ++i) {
    cin >> x >> y;
    addEd(x, y);
    addEd(y, x);
  }
  dfs1(1, 0);
  dfs2(1, 1);
  while (M--) {
    int t, x, y, c;
    cin >> t >> c >> x >> y;
    double start = t, end = t + 1.0 * dist(x, y) / c;
    while (top[x] != top[y])
      if (dep[top[x]] > dep[top[y]]) {
        int t = top[x];
        double dis = 1.0 * (dep[x] - dep[t] + 1) / c;
        now.emplace_back(start, dfn[x], start + dis, dfn[t] - 1, 1, 0);
        x = fa[t];
        start += dis;
      } else {
        int t = top[y];
        double dis = 1.0 * (dep[y] - dep[t] + 1) / c;
        now.emplace_back(end - dis, dfn[t] - 1, end, dfn[y], 0, 1);
        y = fa[t];
        end -= dis;
      }
    now.emplace_back(start, dfn[x], end, dfn[y], 1, 1);
  }
  mnsect = 1e60;
  sort(now.begin(), now.end(), [&](line p, line q) { return p.x1 < q.x1; });
  multimap<double, set<line>::iterator> del0, del1;
  for (auto t : now) {
    if (t.x1 > mnsect) break;
    while (!del0.empty() && del0.begin()->first <= t.x1 + 1e-12) {
      auto t = del0.begin()->second;
      del0.erase(del0.begin());
      auto p = t, q = t;
      if (++p != in.end() && q != in.begin()) getsect(*p, *--q);
      in.erase(t);
    }
    while (!del1.empty() && del1.begin()->first <= t.x1 - 1e-12) {
      auto t = del1.begin()->second;
      del1.erase(del1.begin());
      auto p = t, q = t;
      if (++p != in.end() && q != in.begin()) getsect(*p, *--q);
      in.erase(t);
    }
    cur = t.x1;
    auto cur = in.insert(t);
    if (!cur.second) {
      mnsect = t.x1;
      break;
    }
    auto p = cur.first;
    ++p;
    if (p != in.end()) getsect(*p, t);
    if (--p != in.begin()) getsect(*--p, t);
    (t.f2 ? del1 : del0).insert(make_pair(t.x2, cur.first));
  }
  if (mnsect > 1e20)
    cout << -1;
  else
    cout << fixed << setprecision(10) << mnsect << endl;
  return 0;
}