#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
const double inf = 1e9;
const double eps = 1e-9;
int n, m;
vector<int> V[N];
int vis[N], dep[N], fa[N], son[N], siz[N], top[N];
void dfs(int x, int f) {
  int mx = 0;
  dep[x] = dep[f] + 1, fa[x] = f, siz[x] = 1;
  for (int i = 0; i < V[x].size(); i++) {
    int t = V[x][i];
    if (t == f) continue;
    dfs(t, x), siz[x] += siz[t];
    if (siz[t] > mx) mx = siz[t], son[x] = t;
  }
}
void dfss(int x, int tp) {
  top[x] = tp;
  if (son[x]) dfss(son[x], tp);
  for (int i = 0; i < V[x].size(); i++) {
    int t = V[x][i];
    if (t == fa[x] || t == son[x]) continue;
    dfss(t, t);
  }
}
inline int lca(int x, int y) {
  while (top[x] ^ top[y])
    dep[top[x]] < dep[top[y]] ? swap(x, y), 0 : 0, x = fa[top[x]];
  return dep[x] < dep[y] ? x : y;
}
double tot, ans = inf;
struct node {
  double t, pt;
  int p, v, tp;
  node() {}
  node(double tim, double pnt, int pos, int spd, int typ) {
    t = tim, pt = pnt, p = pos, v = spd, tp = typ;
  }
  friend bool operator<(node a, node b) {
    double ap = a.p + (tot - a.t) * a.v, bp = b.p + (tot - b.t) * b.v;
    if (fabs(ap - bp) < eps) return a.v < b.v;
    return ap < bp;
  }
} tmp;
multiset<node> S;
vector<node> P[N], L;
multiset<node>::iterator r, p;
double calc(node x, node y) {
  double px = x.p + (tot - x.t) * x.v, py = y.p + (tot - y.t) * y.v;
  if (fabs(x.v - y.v) < eps) return fabs(px - py) < eps ? 0.0 : inf;
  double ret = (px - py) / (y.v - x.v);
  if (ret + eps > 0.0 && tot + ret < min(x.pt, y.pt) + eps)
    return ret;
  else
    return inf;
}
inline void ins(int s, double &tim, double add, int pos, int v) {
  double x = tim, y = (tim += add);
  x > y ? x += eps, y -= eps : (y += eps, x -= eps);
  P[s].push_back(node(x, y, pos, v, x < y));
  P[s].push_back(node(y, x, pos, v, x > y));
}
inline void sol(int fr, int to, int t, int v) {
  int l = lca(fr, to);
  double tot = t + (double)(dep[fr] + dep[to] - dep[l] * 2) / v,
         tim = (double)t;
  while (top[fr] ^ top[l])
    ins(top[fr], tim, (double)(dep[fr] - dep[fa[top[fr]]]) / v, dep[fr], -v),
        fr = fa[top[fr]];
  while (top[to] ^ top[l])
    ins(top[to], tot, -(double)(dep[to] - dep[fa[top[to]]]) / v,
        dep[fa[top[to]]], v),
        to = fa[top[to]];
  ins(top[l], tim, tot - tim, dep[fr], dep[fr] < dep[to] ? v : -v);
}
bool cmp(node a, node b) {
  if (a.t == b.t) return a.tp > b.tp + eps;
  return a.t + eps < b.t;
}
int main() {
  scanf("%d%d", &n, &m), L.push_back(node());
  for (int x, y, i = 1; i < n; i++)
    scanf("%d%d", &x, &y), V[x].push_back(y), V[y].push_back(x);
  dfs(1, 0), dfss(1, 1);
  for (int fr, to, t, v, i = 1; i <= m; i++)
    scanf("%d%d%d%d", &t, &v, &fr, &to), sol(fr, to, t, v);
  for (int id = 1; id <= n; id++)
    if (!vis[top[id]]) {
      int x = top[id];
      vis[x] = true;
      double res = inf;
      S.clear();
      sort(P[x].begin(), P[x].end(), cmp);
      for (int i = 0; i < P[x].size(); i++) {
        tot = P[x][i].t;
        if (tot > res) break;
        if (P[x][i].tp) {
          r = S.lower_bound(P[x][i]);
          if (r != S.end()) res = min(res, tot + calc(*r, P[x][i]));
          r = S.lower_bound(P[x][i]);
          if (r != S.begin()) r--, res = min(res, tot + calc(*r, P[x][i]));
          S.insert(P[x][i]);
        } else {
          tmp = P[x][i], swap(tmp.t, tmp.pt);
          S.erase(S.find(tmp));
          r = S.lower_bound(tmp);
          p = S.lower_bound(tmp);
          if (r != S.end() && p != S.begin())
            p--, res = min(res, tot + calc(*r, *p));
        }
      }
      ans = min(ans, res);
    }
  ans == inf ? puts("-1") : printf("%.6lf\n", ans);
}
