#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;
}
