Problem: Tony Stark is playing a game with his suits (they have auto-pilot now). He lives in Malibu. Malibu has n junctions numbered from 1 to n, connected with n - 1 roads. One can get from a junction to any other junction using these roads (graph of Malibu forms a tree).

Tony has m suits. There's a special plan for each suit. The i-th suit will appear at the moment of time ti in the junction vi, and will move to junction ui using the shortest path between vi and ui with the speed ci roads per second (passing a junctions takes no time), and vanishing immediately when arriving at ui (if it reaches ui in time q, it's available there at moment q, but not in further moments). Also, suits move continuously (for example if vi ≠ ui, at time <image> it's in the middle of a road. Please note that if vi = ui it means the suit will be at junction number vi only at moment ti and then it vanishes. 

An explosion happens if at any moment of time two suits share the same exact location (it may be in a junction or somewhere on a road; while appearing, vanishing or moving).

Your task is to tell Tony the moment of the the first explosion (if there will be any).

Input

The first line of the input contains two integers n and m (1 ≤ n, m ≤ 100 000) — the number of junctions and the number of suits respectively.

The next n - 1 lines contain the roads descriptions. Each line contains two integers ai and bi — endpoints of the i-th road (1 ≤ ai, bi ≤ n, ai ≠ bi).

The next m lines contain the suit descriptions. The i-th of them contains four integers ti, ci, vi and ui (0 ≤ ti ≤ 10 000, 1 ≤ ci ≤ 10 000, 1 ≤ vi, ui ≤ n), meaning the i-th suit will appear at moment of time ti at the junction vi and will move to the junction ui with a speed ci roads per second.

Output

If there would be no explosions at all, print -1 in the first and only line of output.

Otherwise print the moment of the first explosion.

Your answer will be considered correct if its relative or absolute error doesn't exceed 10 - 6.

Examples

Input

6 4
2 5
6 5
3 6
4 6
4 1
27 6 1 3
9 5 1 6
27 4 3 4
11 29 2 6


Output

27.3


Input

6 4
3 1
4 5
6 4
6 1
2 6
16 4 4 5
13 20 6 2
3 16 4 5
28 5 3 5


Output

-1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
struct Frac {
  long long c, d;
  Frac() {}
  Frac(long long x) : c(x), d(1) {}
  Frac(long long _c, long long _d) {
    c = _c, d = _d;
    if (d < 0) c = -c, d = -d;
  }
  friend bool operator<(Frac A, Frac B) { return A.c * B.d < B.c * A.d; }
  friend bool operator==(Frac A, Frac B) { return A.c * B.d == B.c * A.d; }
  friend Frac operator*(int A, Frac B) { return Frac(B.c * A, B.d); }
  friend Frac operator+(Frac A, Frac B) {
    if (A.d == B.d) Frac(A.c + B.c, A.d);
    return Frac(A.c * B.d + B.c * A.d, A.d * B.d);
  }
};
const int MN = 100005, MQ = 100005, MS = 3200005;
int N, Q, qu[MQ], qv[MQ], qt[MQ], qc[MQ];
std::vector<int> G[MN];
int faz[MN], dep[MN], siz[MN], son[MN], top[MN];
void DFS0(int u, int fz) {
  dep[u] = dep[faz[u] = fz] + 1, siz[u] = 1;
  for (auto v : G[u])
    if (v != fz) {
      DFS0(v, u), siz[u] += siz[v];
      if (siz[son[u]] < siz[v]) son[u] = v;
    }
}
void DFS1(int u, int t) {
  top[u] = t;
  if (son[u]) DFS1(son[u], t);
  for (auto v : G[u])
    if (v != faz[u] && v != son[u]) DFS1(v, v);
}
Frac ql[MS], qr[MS];
int qk[MS], qb[MS], cnt;
std::vector<int> V[MN];
inline int Dist(int x, int y) {
  int ans = dep[x] + dep[y];
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) std::swap(x, y);
    x = faz[top[x]];
  }
  return ans - 2 * std::min(dep[x], dep[y]);
}
inline void Add(int x, int y, int t, int c) {
  int dis = Dist(x, y), dx = 0, dy = dis;
  t *= c;
  while (top[x] != top[y]) {
    ++cnt;
    if (dep[top[x]] > dep[top[y]]) {
      ql[cnt] = Frac(t + dx, c);
      dx += dep[x] - dep[top[x]] + 1;
      qr[cnt] = Frac(t + dx, c);
      qk[cnt] = -c;
      qb[cnt] = dx + t;
      V[top[x]].push_back(-cnt);
      V[top[x]].push_back(cnt);
      x = faz[top[x]];
    } else {
      qr[cnt] = Frac(t + dy, c);
      dy -= dep[y] - dep[top[y]] + 1;
      ql[cnt] = Frac(t + dy, c);
      qk[cnt] = c;
      qb[cnt] = -(dy + t);
      V[top[y]].push_back(-cnt);
      V[top[y]].push_back(cnt);
      y = faz[top[y]];
    }
  }
  ++cnt;
  ql[cnt] = Frac(t + dx, c);
  qr[cnt] = Frac(t + dy, c);
  if (dep[x] < dep[y]) {
    qk[cnt] = c;
    qb[cnt] = dep[x] - dep[top[x]] + 1 - dx - t;
  } else {
    qk[cnt] = -c;
    qb[cnt] = dep[x] - dep[top[x]] + 1 + dx + t;
  }
  V[top[x]].push_back(-cnt);
  V[top[x]].push_back(cnt);
}
int o;
Frac T, ans;
struct cmp {
  bool operator()(int i, int j) {
    Frac iz = qk[i] * T + qb[i], jz = qk[j] * T + qb[j];
    if (iz == jz) return i < j;
    return iz < jz;
  }
};
std::set<int, cmp> st;
inline void Solve(int u) {
  std::sort(V[u].begin(), V[u].end(), [](int i, int j) {
    Frac iz = i < 0 ? ql[-i] : qr[i], jz = j < 0 ? ql[-j] : qr[j];
    if (iz == jz) return i < j;
    return iz < jz;
  });
  st.clear();
  auto chk = [&](int i, int j) {
    Frac lb = std::max(ql[i], ql[j]);
    Frac rb = std::min(qr[i], qr[j]);
    if (qk[i] == qk[j]) {
      if (qb[i] != qb[j]) return;
      if (!o)
        o = 1, ans = lb;
      else
        ans = std::min(ans, lb);
    } else {
      Frac z(qb[i] - qb[j], qk[j] - qk[i]);
      if (z < lb || rb < z) return;
      if (!o)
        o = 1, ans = z;
      else
        ans = std::min(ans, z);
    }
  };
  for (int id : V[u]) {
    T = id < 0 ? ql[-id] : qr[id];
    if (o && !(T < ans)) break;
    if (id < 0) {
      id = -id;
      auto it = st.insert(id).first;
      auto lst = it, nxt = it;
      if (lst == st.begin())
        lst = st.end();
      else
        --lst;
      ++nxt;
      if (lst != st.end()) chk(id, *lst);
      if (nxt != st.end()) chk(id, *nxt);
    } else {
      auto it = st.erase(st.lower_bound(id));
      if (it == st.end() || it == st.begin()) continue;
      auto jt = it;
      --jt;
      chk(*it, *jt);
    }
  }
}
int main() {
  scanf("%d%d", &N, &Q);
  for (int i = 1, x, y; i < N; ++i)
    scanf("%d%d", &x, &y), G[x].push_back(y), G[y].push_back(x);
  for (int i = 1; i <= N; ++i) reverse(G[i].begin(), G[i].end());
  DFS0(1, 0), DFS1(1, 1);
  for (int i = 1; i <= Q; ++i) {
    scanf("%d%d%d%d", &qt[i], &qc[i], &qu[i], &qv[i]);
    Add(qu[i], qv[i], qt[i], qc[i]);
  }
  for (int i = 1; i <= N; ++i)
    if (i == top[i]) Solve(i);
  if (!o)
    puts("-1");
  else
    printf("%.8lf\n", ans.c / (double)ans.d);
  return 0;
}