#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const double eps = 1e-10;
int rd() {
  int x = 0, w = 1;
  char ch = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch ^ 48);
    ch = getchar();
  }
  return x * w;
}
int to[N << 1], nt[N << 1], hd[N], tot = 1;
void adde(int x, int y) {
  ++tot, to[tot] = y, nt[tot] = hd[x], hd[x] = tot;
  ++tot, to[tot] = x, nt[tot] = hd[y], hd[y] = tot;
}
int n, m, fa[N], de[N], sz[N], hs[N], dfn[N], ti, top[N];
void dfs1(int x) {
  sz[x] = 1;
  for (int i = hd[x]; i; i = nt[i]) {
    int y = to[i];
    if (y == fa[x]) continue;
    fa[y] = x, de[y] = de[x] + 1, dfs1(y);
    sz[x] += sz[y], hs[x] = sz[hs[x]] > sz[y] ? hs[x] : y;
  }
}
void dfs2(int x) {
  dfn[x] = ++ti;
  if (hs[x]) top[hs[x]] = top[x], dfs2(hs[x]);
  for (int i = hd[x]; i; i = nt[i]) {
    int y = to[i];
    if (y == fa[x] || y == hs[x]) continue;
    top[y] = y, dfs2(y);
  }
}
int glca(int x, int y) {
  while (top[x] != top[y]) {
    if (de[top[x]] < de[top[y]]) swap(x, y);
    x = fa[top[x]];
  }
  return de[x] < de[y] ? x : y;
}
int tz;
double ps[N * 30][2], pt, ans = 114514;
struct node {
  double x, k, b;
  int i, o;
  bool operator<(const node &bb) const {
    double s1 = k * pt + b, s2 = bb.k * pt + bb.b;
    if (fabs(s1 - s2) > eps) return s1 < s2;
    if (fabs(x - bb.x) > eps) return x < bb.x;
    if (o != bb.o) return o < bb.o;
    return i < bb.i;
  }
  double s(double x) { return k * x + b; }
} bz[N * 30];
bool cmp(node aa, node bb) {
  return fabs(aa.x - bb.x) > eps ? aa.x < bb.x : aa.o > bb.o;
}
vector<node> qr[N];
void addq(int x, double xl, double xr, double yl, double yr) {
  ps[++tz][0] = xl, ps[tz][1] = xr;
  double nk = fabs(xl - xr) > eps ? (yr - yl) / (xr - xl) : 1,
         nb = yl - nk * xl;
  qr[top[x]].push_back((node){xl, nk, nb, tz, 1});
  qr[top[x]].push_back((node){xr, nk, nb, tz, 0});
}
multiset<node> sb;
multiset<node>::iterator it, ft, nx;
void cal(int i, int j) {
  if (max(ps[i][0], ps[j][0]) > min(ps[i][1], ps[j][1]) + eps) return;
  if (fabs(bz[i].k - bz[j].k) < eps) {
    if (fabs(bz[i].b - bz[j].b) > eps) return;
    ans = min(ans, max(ps[i][0], ps[j][0]));
    return;
  }
  if (fabs(bz[j].s(pt) - bz[i].s(pt)) < eps) {
    ans = min(ans, pt);
    return;
  }
  double nv = bz[i].k < bz[j].k
                  ? -1
                  : pt + (bz[j].s(pt) - bz[i].s(pt)) / (bz[i].k - bz[j].k);
  if (nv > max(ps[i][0], ps[j][0]) - eps && nv < min(ps[i][1], ps[j][1]) + eps)
    ans = min(ans, nv);
}
int main() {
  n = rd(), m = rd();
  for (int i = 1; i < n; ++i) adde(rd(), rd());
  de[1] = 1, dfs1(1);
  top[1] = 1, dfs2(1);
  while (m--) {
    double t = rd(), v = rd();
    v = 1 / v;
    int x = rd(), y = rd(), lca = glca(x, y);
    bool fg = 0;
    double xl, xr, yl, yr, lt = t + v * (double)(de[x] + de[y] - 2 * de[lca]);
    while (top[x] != top[lca]) {
      xl = t, xr = t + v * (double)(de[x] - de[fa[top[x]]]), yl = dfn[x],
      yr = (double)dfn[top[x]] - 1;
      addq(x, xl, xr, yl, yr);
      t = xr, x = fa[top[x]];
    }
    if (de[lca] < de[x]) {
      xl = t, xr = t + v * (double)(de[x] - de[lca]), yl = dfn[x],
      yr = dfn[lca];
      fg = 1, addq(lca, xl, xr, yl, yr);
    }
    t = lt;
    while (top[y] != top[lca]) {
      xl = t - v * (double)(de[y] - de[fa[top[y]]]), xr = t,
      yl = (double)dfn[top[y]] - 1, yr = dfn[y];
      addq(y, xl, xr, yl, yr);
      t = xl, y = fa[top[y]];
    }
    if (de[lca] < de[y]) {
      xl = t - v * (double)(de[y] - de[lca]), xr = t, yl = dfn[lca],
      yr = dfn[y];
      fg = 1, addq(lca, xl, xr, yl, yr);
    }
    if (!fg) addq(top[lca], t, t, dfn[lca], dfn[lca]);
  }
  for (int x = 1; x <= n; ++x) {
    int tq = qr[x].size();
    if (!tq) continue;
    sort(qr[x].begin(), qr[x].end(), cmp);
    sb.clear();
    for (int i = 0; i < tq; ++i) {
      pt = qr[x][i].x;
      if (pt > ans - eps) break;
      int j = qr[x][i].i, k = 0, l = 0;
      if (qr[x][i].o) {
        bz[j] = (node){pt, qr[x][i].k, qr[x][i].b, j, 1};
        it = sb.insert(bz[j]);
        if (it != sb.begin()) ft = it, k = (*(--ft)).i, cal(k, j);
        if (it != (--sb.end())) nx = it, l = (*(++nx)).i, cal(j, l);
      } else {
        it = sb.find(bz[j]);
        assert((*it).i == j);
        if (it != sb.begin()) ft = it, k = (*(--ft)).i;
        if (it != (--sb.end())) nx = it, l = (*(++nx)).i;
        if (k && l) cal(k, l);
        sb.erase(it);
      }
    }
  }
  ans < 114514 ? printf("%.8lf\n", ans) : puts("-1");
  return 0;
}
