#include <bits/stdc++.h>
clock_t t = clock();
namespace my_std {
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
inline T rnd(T l, T r) {
  return uniform_int_distribution<T>(l, r)(rng);
}
template <typename T>
inline bool chkmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
template <typename T>
inline bool chkmin(T &x, T y) {
  return x > y ? x = y, 1 : 0;
}
template <typename T>
inline void read(T &t) {
  t = 0;
  char f = 0, ch = getchar();
  double d = 0.1;
  while (ch > '9' || ch < '0') f |= (ch == '-'), ch = getchar();
  while (ch <= '9' && ch >= '0') t = t * 10 + ch - 48, ch = getchar();
  if (ch == '.') {
    ch = getchar();
    while (ch <= '9' && ch >= '0') t += d * (ch ^ 48), d *= 0.1, ch = getchar();
  }
  t = (f ? -t : t);
}
template <typename T, typename... Args>
inline void read(T &t, Args &...args) {
  read(t);
  read(args...);
}
char __sr[1 << 21], __z[20];
int __C = -1, __zz = 0;
inline void Ot() { fwrite(__sr, 1, __C + 1, stdout), __C = -1; }
inline void print(register int x) {
  if (__C > 1 << 20) Ot();
  if (x < 0) __sr[++__C] = '-', x = -x;
  while (__z[++__zz] = x % 10 + 48, x /= 10)
    ;
  while (__sr[++__C] = __z[__zz], --__zz)
    ;
  __sr[++__C] = '\n';
}
void file() {}
inline void chktime() {}
long long ksm(long long x, int y) {
  long long ret = 1;
  for (; y; y >>= 1, x = x * x)
    if (y & 1) ret = ret * x;
  return ret;
}
}  // namespace my_std
using namespace my_std;
const long double eps = 1e-9;
int n, m;
struct hh {
  int t, nxt;
} edge[101010 << 1];
int head[101010], ecnt;
void make_edge(int f, int t) {
  edge[++ecnt] = (hh){t, head[f]};
  head[f] = ecnt;
  edge[++ecnt] = (hh){f, head[t]};
  head[t] = ecnt;
}
int dfn[101010], top[101010], son[101010], size[101010], fa[101010],
    dep[101010], cnt;
void dfs1(int x, int fa) {
  dep[x] = dep[::fa[x] = fa] + 1;
  size[x] = 1;
  for (int i = head[x]; i; i = edge[i].nxt)
    if (edge[i].t != fa) {
      dfs1(edge[i].t, x);
      size[x] += size[edge[i].t];
      if (size[edge[i].t] > size[son[x]]) son[x] = edge[i].t;
    }
}
void dfs2(int x, int fa, int tp) {
  dfn[x] = ++cnt;
  top[x] = tp;
  if (son[x]) dfs2(son[x], x, tp);
  for (int i = head[x]; i; i = edge[i].nxt)
    if (edge[i].t != fa && edge[i].t != son[x]) dfs2(edge[i].t, x, edge[i].t);
}
inline int dcmp(long double x) { return fabs(x) <= eps ? 0 : (x > 0 ? 1 : -1); }
struct Vector {
  long double x, y;
  Vector(long double xx = 0, long double yy = 0) { x = xx, y = yy; }
  inline const Vector operator+(const Vector &a) const {
    return Vector(x + a.x, y + a.y);
  }
  inline const Vector operator-(const Vector &a) const {
    return Vector(x - a.x, y - a.y);
  }
  inline const Vector operator*(const long double &a) const {
    return Vector(x * a, y * a);
  }
  inline const Vector operator/(const long double &a) const {
    return Vector(x / a, y / a);
  }
  inline const bool operator<(const Vector &a) const {
    return dcmp(x - a.x) == 0 ? dcmp(y - a.y) < 0 : dcmp(x - a.x) < 0;
  }
  inline const bool operator==(const Vector &a) const {
    return dcmp(x - a.x) == 0 && dcmp(y - a.y) == 0;
  }
  inline const bool operator!=(const Vector &a) const {
    return dcmp(x - a.x) != 0 || dcmp(y - a.y) != 0;
  }
};
inline long double Dot(Vector a, Vector b) { return a.x * b.x + a.y * b.y; }
inline long double Cross(Vector a, Vector b) { return a.x * b.y - a.y * b.x; }
inline long double Len(Vector a) { return sqrt(Dot(a, a)); }
struct Line {
  Vector a, b;
  Line() {}
  Line(Vector aa, Vector bb) { a = aa, b = bb; }
};
vector<Line> vec[101010];
struct hhh {
  long double x;
  int id, type;
  const bool operator<(const hhh &a) const {
    if (dcmp(x - a.x)) return x < a.x;
    return type < a.type;
  }
} ss[101010 * 20];
inline bool OnSeg(Vector p, Line x) {
  Vector a = x.a, b = x.b;
  return dcmp(Cross(p - a, a - b)) == 0 && dcmp(Dot(p - a, p - b)) <= 0;
}
inline Vector LI(Line l1, Line l2) {
  Vector v = l1.a - l2.a, v1 = l1.b - l1.a, v2 = l2.b - l2.a;
  long double t = Cross(v, v2) / Cross(v2, v1);
  return l1.a + v1 * t;
}
inline bool LSI(Line l, Vector a, Vector b) {
  Vector v = l.b - l.a, v1 = a - l.a, v2 = b - l.a;
  return dcmp(Cross(v, v1)) != dcmp(Cross(v, v2));
}
inline long double SSI(Line l1, Line l2) {
  long double ret = 1e9;
  if (OnSeg(l1.a, l2)) chkmin(ret, l1.a.x);
  if (OnSeg(l1.b, l2)) chkmin(ret, l1.b.x);
  if (OnSeg(l2.a, l1)) chkmin(ret, l2.a.x);
  if (OnSeg(l2.b, l1)) chkmin(ret, l2.b.x);
  if (ret < 1e9) return ret;
  if (!LSI(l1, l2.a, l2.b) || !LSI(l2, l1.a, l1.b)) return 1e9;
  return LI(l1, l2).x;
}
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]];
  }
  return dep[x] > dep[y] ? y : x;
}
void add(int x, int y, long double T, long double V) {
  V = 1.0 / V;
  int l = lca(x, y);
  long double Len = dep[y] - dep[l];
  while (top[x] != top[l]) {
    long double len = dep[x] - dep[top[x]] + 1;
    vec[top[x]].push_back(
        Line(Vector(T, dfn[x]), Vector(T + len * V, dfn[top[x]] - 1)));
    x = fa[top[x]];
    T += len * V;
  }
  long double len = dep[x] - dep[l];
  if (x != l)
    vec[top[x]].push_back(Line(Vector(T, dfn[x]), Vector(T + len * V, dfn[l])));
  T += len * V;
  while (top[y] != top[l]) {
    long double len = dep[y] - dep[top[y]] + 1;
    Len -= len;
    vec[top[y]].push_back(Line(Vector(T + Len * V, dfn[top[y]] - 1),
                               Vector(T + len * V + Len * V, dfn[y])));
    y = fa[top[y]];
  }
  len = dep[y] - dep[l];
  if (y != l)
    vec[top[y]].push_back(Line(Vector(T, dfn[l]), Vector(T + len * V, dfn[y])));
  if (x == l && y == l)
    vec[top[l]].push_back(Line(Vector(T, dfn[l]), Vector(T, dfn[l])));
}
vector<Line> s;
long double T;
struct cmp {
  const bool operator()(const int &x, const int &y) const {
    Line l1 = s[x], l2 = s[y];
    long double y1;
    if (dcmp(l1.b.x - l1.a.x))
      y1 = (l1.a + (l1.b - l1.a) * (T - l1.a.x) / (l1.b.x - l1.a.x)).y;
    else
      y1 = l1.a.y;
    long double y2;
    if (dcmp(l2.b.x - l2.a.x))
      y2 = (l2.a + (l2.b - l2.a) * (T - l2.a.x) / (l2.b.x - l2.a.x)).y;
    else
      y2 = l2.a.y;
    return y1 < y2;
  }
};
set<int, cmp> S;
long double ans = 1e9;
void work() {
  long double ans = 1e9;
  int M = s.size();
  s.push_back(Line(Vector(), Vector()));
  for (int i = (0); i <= (M - 1); i++)
    ss[i * 2] = (hhh){s[i].a.x, i, 0}, ss[i * 2 + 1] = (hhh){s[i].b.x, i, 1};
  sort(ss, ss + M + M);
  for (int i = (0); i <= (M + M - 1); i++) {
    if (ss[i].x > ans) break;
    if (ss[i].type) {
      auto it = S.find(ss[i].id);
      if (it != S.begin() && next(it) != S.end())
        chkmin(ans, SSI(s[*prev(it)], s[*next(it)]));
      S.erase(ss[i].id);
    } else {
      T = ss[i].x;
      s[M] = Line(Vector(T, s[ss[i].id].a.y), Vector(T, s[ss[i].id].a.y));
      if (S.find(M) != S.end()) {
        ans = T;
        break;
      }
      auto it = S.insert(ss[i].id).first;
      if (it != S.begin()) chkmin(ans, SSI(s[*it], s[*prev(it)]));
      if (next(it) != S.end()) chkmin(ans, SSI(s[*it], s[*next(it)]));
    }
  }
  chkmin(::ans, ans);
  S.clear();
}
int main() {
  file();
  read(n, m);
  int x, y;
  for (int i = (1); i <= (n - 1); i++) read(x, y), make_edge(x, y);
  dfs1(1, 0), dfs2(1, 0, 1);
  while (m--) {
    int v, t;
    read(t, v, x, y);
    add(x, y, t, v);
  }
  for (int i = (1); i <= (n); i++)
    if (top[i] == i) s = vec[i], work();
  if (ans < 1e9)
    cout << setprecision(20) << fixed << ans;
  else
    puts("-1");
  return 0;
}
