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;
template <typename T>
inline T qmin(const T &x, const T &y) {
  return x < y ? x : y;
}
template <typename T>
inline T qmax(const T &x, const T &y) {
  return x > y ? x : y;
}
template <typename T>
inline void getmin(T &x, const T &y) {
  if (y < x) x = y;
}
template <typename T>
inline void getmax(T &x, const T &y) {
  if (y > x) x = y;
}
inline void fileio(const string &s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
const int inf = (int)1e9 + 7;
const long long linf = (long long)1e18 + 7;
const int N = 1e5 + 7, M = N << 1;
const double eps = 1e-10;
inline int sgn(const double &x) { return fabs(x) < eps ? 0 : (x > 0 ? 1 : -1); }
double cur;
struct item {
  double st, ed, pos, v;
  inline item(const double &a = 0, const double &b = 0, const double &c = 0,
              const double &d = 0)
      : st(a), ed(b), pos(c), v(d) {}
  inline double qpos(const double &x) const { return (x - st) * v + pos; }
  inline bool operator<(const item &b) const {
    return sgn(qpos(cur) - b.qpos(cur)) < 0;
  }
};
inline bool cmpst(const item &a, const item &b) { return a.st < b.st; }
inline bool cmped(const item &a, const item &b) { return a.ed < b.ed; }
inline bool inter(const item &a, const item &b) {
  double l = qmax(a.st, b.st), r = qmin(a.ed, b.ed);
  if (sgn(r - l) < 0) return false;
  return sgn(a.qpos(l) - b.qpos(l)) * sgn(a.qpos(r) - b.qpos(r)) <= 0;
}
inline double qtime(const item &a, const item &b) {
  double l = qmax(a.st, b.st);
  if (sgn(a.v - b.v) == 0) return l;
  return (a.qpos(l) - b.qpos(l)) / (b.v - a.v) + l;
}
int v[M], nxt[M];
int head[N];
int sz[N], dep[N], child[N];
int top[N], par[N], id[N];
vector<item> ev[N];
int n, m;
double ans = inf;
inline void addedge(int p, int x, int y) {
  v[p] = y, nxt[p] = head[x], head[x] = p;
}
inline void dfs1(const int &u, const int &p) {
  par[u] = p;
  dep[u] = dep[p] + 1;
  sz[u] = 1;
  child[u] = 0;
  for (int e = head[u]; e; e = nxt[e]) {
    if (v[e] == p) continue;
    dfs1(v[e], u);
    sz[u] += sz[v[e]];
    if (sz[v[e]] > sz[child[u]]) child[u] = v[e];
  }
}
inline void dfs2(const int &u, const int &from) {
  top[u] = from;
  id[u] = dep[u] - dep[from] + 1;
  if (child[u]) dfs2(child[u], from);
  for (int e = head[u]; e; e = nxt[e]) {
    if (v[e] == child[u] || v[e] == par[u]) continue;
    dfs2(v[e], v[e]);
  }
}
inline int getlca(int x, int y) {
  while (top[x] != top[y]) {
    if (dep[top[x]] > dep[top[y]])
      x = par[top[x]];
    else
      y = par[top[y]];
  }
  return dep[x] < dep[y] ? x : y;
}
inline bool goup(int x, int des, double t, double c) {
  while (top[x] != top[des]) {
    ev[top[x]].push_back(item(t, t + id[x] / c, id[x], -c));
    t += id[x] / c;
    x = par[top[x]];
  }
  if (x == des) return false;
  ev[top[x]].push_back(item(t, t + double(dep[x] - dep[des]) / c, id[x], -c));
  return true;
}
inline bool godown(int x, int des, double t, double c) {
  while (top[x] != top[des]) {
    ev[top[x]].push_back(item(t - id[x] / c, t, 0, c));
    t -= id[x] / c;
    x = par[top[x]];
  }
  if (x == des) return false;
  ev[top[x]].push_back(item(t - double(dep[x] - dep[des]) / c, t, id[des], c));
  return true;
}
set<item> s;
inline void solve(vector<item> &a) {
  if (a.empty()) return;
  int n = a.size();
  sort(a.begin(), a.end(), cmpst);
  vector<item> b = a;
  sort(b.begin(), b.end(), cmped);
  s.clear();
  int lst = 0;
  for (register int i = 0; i < (n); ++i) {
    if (sgn(a[i].st - ans) >= 0) return;
    while (lst < n && sgn(a[i].st - b[lst].ed) > 0) s.erase(b[lst++]);
    cur = a[i].st;
    set<item>::iterator it = s.lower_bound(a[i]);
    if (it != s.end()) {
      if (sgn(it->qpos(cur) - a[i].qpos(cur)) == 0) {
        ans = cur;
        return;
      }
      if (inter(*it, a[i])) getmin(ans, qtime(*it, a[i]));
    }
    if (it != s.begin()) {
      --it;
      if (inter(*it, a[i])) getmin(ans, qtime(*it, a[i]));
    }
    s.insert(a[i]);
  }
}
inline void dfs(const int &u) {
  if (top[u] == u) {
    solve(ev[u]);
  }
  for (int e = head[u]; e; e = nxt[e]) {
    if (v[e] == par[u]) continue;
    dfs(v[e]);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (register int i = (1); i <= (n - 1); ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    addedge(((i) << 1), x, y);
    addedge(((i) << 1 ^ 1), y, x);
  }
  dfs1(1, 0);
  dfs2(1, 1);
  for (register int i = (1); i <= (m); ++i) {
    int x, y, c, t, lca;
    scanf("%d%d%d%d", &t, &c, &x, &y);
    lca = getlca(x, y);
    bool flag = false;
    flag |= goup(x, lca, t, c);
    flag |=
        godown(y, lca, t + double(dep[x] + dep[y] - (dep[lca] << 1)) / c, c);
    if (!flag) {
      double tm = t + double(dep[x] - dep[lca]) / c;
      ev[top[lca]].push_back(item(tm, tm, id[lca], c));
    }
  }
  dfs(1);
  if (sgn(ans - inf) == 0)
    puts("-1");
  else
    printf("%.11lf\n", ans);
  return 0;
}