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 void read(_T &f) {
  f = 0;
  _T fu = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') {
      fu = -1;
    }
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    f = (f << 3) + (f << 1) + (c & 15);
    c = getchar();
  }
  f *= fu;
}
template <typename T>
void print(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x < 10)
    putchar(x + 48);
  else
    print(x / 10), putchar(x % 10 + 48);
}
template <typename T>
void print(T x, char t) {
  print(x);
  putchar(t);
}
const double eps = 1e-10;
const int N = 1e5 + 5;
vector<int> adj[N];
int siz[N], wson[N], top[N], tops[N], fa[N], d[N], id[N];
int n, m, dfn, tot;
void dfs1(int u) {
  siz[u] = 1;
  for (auto v : adj[u]) {
    if (v == fa[u]) continue;
    fa[v] = u;
    d[v] = d[u] + 1;
    dfs1(v);
    siz[u] += siz[v];
    id[v] = tot;
    tot += 2;
    if (siz[v] > siz[wson[u]]) wson[u] = v;
  }
}
void dfs2(int u, int tp) {
  tops[u] = ++dfn;
  top[u] = tp;
  if (wson[u]) dfs2(wson[u], tp);
  for (auto v : adj[u]) {
    if (v == fa[u] || v == wson[u]) continue;
    dfs2(v, v);
  }
}
vector<pair<int, int> > getpath(int u, int v) {
  vector<pair<int, int> > p[2];
  int opt = 0;
  while (top[u] != top[v]) {
    if (d[top[u]] < d[top[v]]) swap(u, v), opt ^= 1;
    p[opt].push_back(make_pair(u, top[u]));
    u = fa[top[u]];
  }
  if (d[u] < d[v]) swap(u, v), opt ^= 1;
  p[opt].push_back(make_pair(u, v));
  for (int i = (int)p[1].size() - 1; i >= 0; i--)
    p[0].push_back(make_pair(p[1][i].second, p[1][i].first));
  return p[0];
}
struct ele {
  double st, ed;
  int v, pos;
};
double TT, ans = 1e18;
bool operator<(const ele a, const ele b) {
  double ap = a.pos + (TT - a.st) * a.v;
  double bp = b.pos + (TT - b.st) * b.v;
  if (fabs(ap - bp) <= eps) return 0;
  return ap < bp;
}
bool operator==(const ele a, const ele b) { return !(a < b) && !(b < a); }
set<ele> all;
struct naive {
  ele val;
  double t;
  int opt;
};
bool operator<(const naive a, const naive b) {
  if (fabs(a.t - b.t) < eps) return a.opt > b.opt;
  return a.t < b.t;
}
vector<naive> e;
void solve(ele a, ele b) {
  double ap = a.pos + (TT - a.st) * a.v;
  double bp = b.pos + (TT - b.st) * b.v;
  if (fabs(ap - bp) < eps) ans = min(ans, TT);
  if (a.v == b.v) return;
  double T = (bp - ap) / (a.v - b.v);
  if (T < 0) return;
  T += TT;
  T -= eps;
  if (T <= a.ed && T <= b.ed) ans = min(ans, T);
}
int main() {
  read(n);
  read(m);
  tot = n + 1;
  for (int i = 1; i < n; i++) {
    int u, v;
    read(u);
    read(v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs1(1);
  dfs2(1, 1);
  for (int i = 1; i <= m; i++) {
    int t, c, u, v;
    read(t);
    read(c);
    read(u);
    read(v);
    vector<pair<int, int> > p = getpath(u, v);
    double nowt = t;
    for (int j = 0; j < (int)p.size(); j++) {
      ele now;
      if (tops[p[j].first] <= tops[p[j].second])
        now = (ele){nowt, nowt + (double)(d[p[j].second] - d[p[j].first]) / c,
                    c, tops[p[j].first]};
      else
        now = (ele){nowt, nowt + (double)(d[p[j].first] - d[p[j].second]) / c,
                    -c, tops[p[j].first]};
      e.push_back((naive){now, nowt, 1});
      nowt = now.ed;
      e.push_back((naive){now, nowt, -1});
      if (j == (int)p.size() - 1) break;
      int x = p[j].second, y = p[j + 1].first;
      if (tops[x] > tops[y]) {
        now = (ele){nowt, nowt + 1.0 / c, c, id[x]};
        e.push_back((naive){now, nowt, 1});
        nowt = now.ed;
        e.push_back((naive){now, nowt, -1});
      } else {
        now = (ele){nowt, nowt + 1.0 / c, -c, id[y] + 1};
        e.push_back((naive){now, nowt, 1});
        nowt = now.ed;
        e.push_back((naive){now, nowt, -1});
      }
    }
  }
  sort(e.begin(), e.end());
  for (auto i : e) {
    TT = i.t;
    if (TT > ans) break;
    if (i.opt == -1) {
      auto it = all.upper_bound(i.val), it2 = it;
      --it2;
      if (it != all.end() && it2 != all.begin()) {
        --it2;
        solve(*it, *it2);
      }
      all.erase(i.val);
      continue;
    }
    auto it = all.lower_bound(i.val);
    if (it != all.end()) solve(i.val, *it);
    if (it != all.begin()) --it, solve(i.val, *it);
    all.insert(i.val);
  }
  if (fabs(ans - 1e18) <= eps)
    puts("-1");
  else
    printf("%.7lf\n", ans);
  return 0;
}