#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void rd(T &x) {
  x = 0;
  char c = getchar();
  int f = 1;
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 - '0' + c, c = getchar();
  x *= f;
}
const long double eps = 1e-8;
int dcmp(long double x) { return x > -eps ? (x > eps) : -1; }
namespace Sol {
long double curt;
}
struct Line {
  long double k, b, l, r;
  Line(long double k = 0, long double b = 0, long double l = -1e19,
       long double r = 1e19)
      : k(k), b(b), r(r) {}
  long double cal(long double x) { return k * x + b; }
  friend bool operator<(Line A, Line B) {
    if (dcmp(A.cal(Sol::curt) - B.cal(Sol::curt)))
      return dcmp(A.cal(Sol::curt) - B.cal(Sol::curt)) < 0;
    long double tl = max(A.l, B.l);
    if (dcmp(A.cal(tl) - B.cal(tl))) return dcmp(A.cal(tl) - B.cal(tl)) < 0;
    if (dcmp(A.k - B.k)) return dcmp(A.k - B.k) < 0;
    if (dcmp(A.b - B.b)) return dcmp(A.b - B.b) < 0;
    if (dcmp(A.l - B.l)) return dcmp(A.l - B.l) < 0;
    return dcmp(A.r - B.r) < 0;
  }
};
struct Event {
  Line l;
  long double p;
  int ty;
  Event(Line l, long double p = 0, int ty = 0) : l(l), p(p), ty(ty) {}
  friend bool operator==(Line A, Line B) {
    return dcmp(A.k - B.k) == 0 && dcmp(A.b - B.b) == 0;
  }
};
namespace Sol {
multiset<Line> S;
bool cmpt(Event A, Event B) {
  if (dcmp(A.p - B.p) == 0) {
    if (A.ty == B.ty) return A.l < B.l;
    return A.ty > B.ty;
  }
  return A.p < B.p;
}
long double ans;
void UPD(Line A, Line B, long double t) {
  long double L = max(A.l, B.l), R = min(A.r, B.r);
  if (dcmp(L - R) > 0) return;
  if (dcmp(A.k - B.k) == 0) {
    if (dcmp(A.b - B.b) == 0) ans = min(ans, L);
    return;
  }
  long double tmp = (A.b - B.b) / (B.k - A.k);
  if (dcmp(tmp - L) >= 0 && dcmp(tmp - R) <= 0) ans = min(ans, tmp);
}
long double sol(vector<Event> &A) {
  S.clear();
  sort(A.begin(), A.end(), cmpt);
  curt = -1e19;
  ans = 1e19;
  for (int i = 0; i < A.size(); ++i) {
    if (dcmp(A[i].p - ans) > 0) break;
    multiset<Line>::iterator it, it2;
    curt = A[i].p;
    if (A[i].ty == 1) {
      it = S.upper_bound(A[i].l);
      if (it != S.end()) UPD(*it, A[i].l, A[i].p);
      if (it != S.begin()) UPD(*(--it), A[i].l, A[i].p);
      S.insert(A[i].l);
    } else {
      S.erase(S.lower_bound(A[i].l));
      it = S.upper_bound(A[i].l);
      if (it != S.end() && it != S.begin()) {
        it2 = it;
        it2--;
        UPD(*it, *it2, A[i].p);
      }
    }
  }
  return ans;
}
}  // namespace Sol
const int N = 1e5 + 10;
int head[N], ecnt, n, m;
struct ed {
  int to, next;
} e[N << 1];
void ad(int x, int y) {
  e[++ecnt] = (ed){y, head[x]};
  head[x] = ecnt;
  e[++ecnt] = (ed){x, head[y]};
  head[y] = ecnt;
}
int dep[N], sz[N], son[N], fa[N], top[N];
void dfs1(int u, int last) {
  sz[u] = 1, dep[u] = dep[fa[u] = last] + 1;
  for (int k = head[u]; k; k = e[k].next) {
    int v = e[k].to;
    if (v == last) continue;
    dfs1(v, u);
    sz[u] += sz[v];
    if (sz[v] > sz[son[u]]) son[u] = v;
  }
}
void dfs2(int u, int tp) {
  top[u] = tp;
  if (son[u]) dfs2(son[u], tp);
  for (int k = head[u]; k; k = e[k].next) {
    int v = e[k].to;
    if (v == fa[u] || v == son[u]) continue;
    dfs2(v, v);
  }
}
int LCA(int x, int y) {
  while (top[x] != top[y])
    dep[fa[top[x]]] > dep[fa[top[y]]] ? x = fa[top[x]] : y = fa[top[y]];
  return dep[x] > dep[y] ? y : x;
}
vector<Event> W[N];
void add(int x, Line L, long double l, long double r) {
  if (l > r) swap(l, r);
  L.r = r, L.l = l;
  W[x].push_back(Event(L, l, 1));
  W[x].push_back(Event(L, r, -1));
}
int ff;
void upd(int x, int f, long double s, long double c, Line L) {
  while (top[x] != top[f]) {
    long double s1 = s - (dep[x] - dep[top[x]] + 1) / c;
    add(top[x], L, s, s1);
    s = s1;
    x = fa[top[x]];
  }
  if (x == f)
    return;
  else
    ff = 1;
  long double s1 = s - (dep[x] - dep[f]) / c;
  add(top[x], L, s, s1);
}
int main() {
  rd(n), rd(m);
  for (int i = 1, x, y; i < n; ++i) rd(x), rd(y), ad(x, y);
  dfs1(1, 0), dfs2(1, 1);
  for (int i = 1; i <= m; ++i) {
    int t, _c, x, y;
    rd(t), rd(_c), rd(x), rd(y);
    long double c = _c;
    int L = LCA(x, y);
    long double ts = t + (dep[x] + dep[y] - 2 * dep[L]) / c;
    ff = 0;
    if (x != L) upd(x, L, t, -c, Line(-c, dep[x] + c * t, -1e19, 1e19));
    if (y != L) upd(y, L, ts, c, Line(c, dep[y] - c * ts, -1e19, 1e19));
    if (!ff) {
      long double tmp = t + (dep[x] - dep[L]) / c;
      add(top[L], Line(c, dep[y] - c * ts, -1e19, 1e19), tmp, tmp);
    }
  }
  long double ans = 1e19;
  for (int i = n; i >= 1; --i)
    if (top[i] == i) ans = min(ans, Sol::sol(W[i]));
  if (ans > 1e18)
    printf("-1");
  else
    printf("%.7Lf\n", ans);
  return 0;
}
