#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void rd(T &x) {
  char ch;
  x = 0;
  bool fl = false;
  while (!isdigit(ch = getchar())) (ch == '-') && (fl = true);
  for (x = (ch ^ '0'); isdigit(ch = getchar()); x = x * 10 + (ch ^ '0'))
    ;
  (fl == true) && (x = -x);
}
template <class T>
inline void output(T x) {
  if (x / 10) output(x / 10);
  putchar(x % 10 + '0');
}
template <class T>
inline void ot(T x) {
  if (x < 0) putchar('-'), x = -x;
  output(x);
  putchar(' ');
}
template <class T>
inline void prt(T a[], int st, int nd) {
  for (register int i = st; i <= nd; ++i) ot(a[i]);
  putchar('\n');
}
namespace Modulo {
const int mod = 998244353;
inline int ad(int x, int y) { return x + y >= mod ? x + y - mod : x + y; }
inline int sub(int x, int y) { return ad(x, mod - y); }
inline int mul(int x, int y) { return (long long)x * y % mod; }
inline void inc(int &x, int y) { x = ad(x, y); }
inline void inc2(int &x, int y) { x = mul(x, y); }
inline int qm(int x, int y = mod - 2) {
  int ret = 1;
  while (y) {
    if (y & 1) ret = mul(x, ret);
    x = mul(x, x);
    y >>= 1;
  }
  return ret;
}
template <class... Args>
inline int ad(const int a, const int b, const Args &...args) {
  return ad(ad(a, b), args...);
}
template <class... Args>
inline int mul(const int a, const int b, const Args &...args) {
  return mul(mul(a, b), args...);
}
}  // namespace Modulo
namespace Miracle {
const int N = 1e5 + 5;
const double inf = 1e13;
const double eps = 1e-9;
int n, m;
struct node {
  int nxt, to;
} eg[2 * N];
int hd[N], cnt;
void add(int x, int y) {
  eg[++cnt].nxt = hd[x];
  eg[cnt].to = y;
  hd[x] = cnt;
}
int dfn[N], df, top[N], fa[N], id[N];
int son[N], sz[N], dep[N];
double X;
int Fabs(double x) {
  if (x > eps) return 1;
  if (x < -eps) return -1;
  return 0;
}
struct line {
  int st, nd;
  double bt, v;
  double friend operator&(line x, line y) {
    if (Fabs(x.v - y.v)) {
      double ny = y.st + (x.bt - y.bt) * y.v;
      double tim = x.bt + (ny - x.st) / (x.v - y.v);
      if (tim > y.bt - eps && tim > x.bt - eps &&
          tim < y.bt + (y.nd - y.st) / y.v + eps &&
          tim < x.bt + (x.nd - x.st) / x.v + eps)
        return tim;
      return inf;
    } else {
      if (Fabs((y.st - x.st) / x.v + x.bt - y.bt) == 0) return max(y.bt, x.bt);
      return inf;
    }
  }
  bool friend operator<(line x, line y) {
    double nx = x.st + (X - x.bt) * x.v, ny = y.st + (X - y.bt) * y.v;
    if (Fabs(nx - ny) != 0) return nx < ny;
    if (Fabs(x.v - y.v) != 0) return x.v < y.v;
    if (x.st != y.st) return x.st < y.st;
    return x.nd < y.nd;
  }
};
struct hl {
  vector<line> mem;
  int st, nd;
} h[N];
int tot;
void dfs(int x) {
  sz[x] = 1;
  dep[x] = dep[fa[x]] + 1;
  for (register int i = hd[x]; i; i = eg[i].nxt) {
    int y = eg[i].to;
    if (y == fa[x]) continue;
    fa[y] = x;
    dfs(y);
    sz[x] += sz[y];
    if (sz[y] > sz[son[x]]) son[x] = y;
  }
}
void dfs2(int x) {
  dfn[x] = ++df;
  if (!top[x]) {
    ++tot;
    if (x == 1)
      h[tot].st = x;
    else
      h[tot].st = fa[x];
    top[x] = x;
    id[x] = tot;
    h[tot].nd = x;
  } else {
    id[x] = id[top[x]];
    h[id[x]].nd = x;
  }
  if (son[x]) top[son[x]] = top[x], dfs2(son[x]);
  for (register int i = hd[x]; i; i = eg[i].nxt) {
    int y = eg[i].to;
    if (y == fa[x]) continue;
    if (y == son[x]) continue;
    dfs2(y);
  }
}
int lca(int x, int y) {
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    x = fa[top[x]];
  }
  if (dep[x] < dep[y]) swap(x, y);
  return y;
}
void push(int x, int y, int t, int c) {
  double xt = t;
  int anc = lca(x, y);
  int dis = dep[x] + dep[y] - 2 * dep[anc];
  double yt = (double)t + (double)dis / c;
  while (top[x] != top[y]) {
    if (dep[top[x]] > dep[top[y]]) {
      int now = id[x];
      line lp;
      lp.bt = xt;
      lp.st = dep[x] - dep[h[now].st];
      lp.nd = 0;
      lp.v = -c;
      h[now].mem.push_back(lp);
      xt += (double)(dep[x] - dep[h[now].st]) / c;
      x = fa[top[x]];
    } else {
      int now = id[y];
      line lp;
      yt -= (double)(dep[y] - dep[h[now].st]) / c;
      lp.bt = yt;
      lp.st = 0;
      lp.nd = dep[y] - dep[h[now].st];
      lp.v = c;
      h[now].mem.push_back(lp);
      y = fa[top[y]];
    }
  }
  if (dep[x] > dep[y]) {
    int now = id[x];
    line lp;
    lp.bt = xt;
    lp.st = dep[x] - dep[h[now].st];
    lp.nd = dep[y] - dep[h[now].st];
    lp.v = -c;
    h[now].mem.push_back(lp);
  } else {
    int now = id[y];
    line lp;
    yt -= (double)(dep[y] - dep[x]) / c;
    lp.bt = yt;
    lp.st = dep[x] - dep[h[now].st];
    lp.nd = dep[y] - dep[h[now].st];
    lp.v = c;
    h[now].mem.push_back(lp);
  }
}
double ans = inf;
struct ev {
  double p;
  int id, tp;
  bool friend operator<(ev a, ev b) {
    if (Fabs(a.p - b.p) != 0) return a.p < b.p;
    return a.tp > b.tp;
  }
} e[2 * N];
multiset<line> s;
int main() {
  rd(n);
  rd(m);
  int x, y;
  for (register int i = 1; i < n; ++i) {
    rd(x);
    rd(y);
    add(x, y);
    add(y, x);
  }
  dfs(1);
  dfs2(1);
  int t, c;
  for (register int i = 1; i <= m; ++i) {
    rd(t);
    rd(c);
    rd(x);
    rd(y);
    push(x, y, t, c);
  }
  ans = inf;
  for (register int i = 1; i <= tot; ++i) {
    int num = 0;
    for (register int o = 0; o < (int)h[i].mem.size(); ++o) {
      line lp = h[i].mem[o];
      e[++num].id = o;
      e[num].p = lp.bt;
      e[num].tp = 1;
      e[++num].id = o;
      e[num].p = lp.bt + (lp.nd - lp.st) / lp.v;
      e[num].tp = -1;
    }
    sort(e + 1, e + num + 1);
    s.clear();
    for (register int j = 1; j <= num; ++j) {
      X = e[j].p;
      if (X > ans - eps) break;
      line lp = h[i].mem[e[j].id];
      if (e[j].tp == 1) {
        s.insert(lp);
        auto bc = s.lower_bound(lp);
        auto tmp = bc;
        ++tmp;
        if (tmp != s.end()) {
          ans = min(ans, (*tmp) & lp);
        }
        tmp = bc;
        if (tmp != s.begin()) {
          --tmp;
          ans = min(ans, (*tmp) & lp);
        }
      } else {
        auto bc = s.lower_bound(lp);
        if (bc != s.end()) {
          if (bc != s.begin()) {
            auto pr = bc;
            --pr;
            ans = min(ans, (*bc) & (*pr));
          }
        }
        auto now = s.find(lp);
        s.erase(now);
      }
    }
  }
  if (ans >= inf - 1)
    puts("-1");
  else
    printf("%.10lf", ans);
  return 0;
}
}  // namespace Miracle
signed main() {
  Miracle::main();
  return 0;
}
