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>
#pragma warning(disable : 4996)
using namespace std;
const int mod = 1000000007;
const int inf = 2012345678;
const long long infl = 9012345678901234567;
const double pi = 3.1415926535897932384626433832795;
struct rat {
  long long a, b;
  rat(long long _a = 0, long long _b = 1) {
    if (_b < 0) _a = -_a, _b = -_b;
    a = _a;
    b = _b;
  }
  bool operator<(const rat& ot) const { return a * ot.b < ot.a * b; }
  rat operator-() const { return rat(-a, b); }
  bool operator==(const rat& ot) const { return a * ot.b == ot.a * b; }
};
const int N = 100000;
const int LG = 17;
vector<int> adj[N];
int rnk[N], up[N], anc[N][LG], down[N], hvc[N], cnt[N];
void dfs0(int u) {
  cnt[u] = 1;
  hvc[u] = -1;
  for (auto& x : adj[u]) {
    if (x == anc[u][0]) continue;
    rnk[x] = rnk[u] + 1;
    anc[x][0] = u;
    dfs0(x);
    cnt[u] += cnt[x];
    if (hvc[u] == -1 || cnt[x] > cnt[hvc[u]]) hvc[u] = x;
  }
}
void dfs1(int u, bool hv) {
  if (hv)
    up[u] = u;
  else
    up[u] = up[anc[u][0]];
  if (hvc[u] == -1) {
    down[u] = u;
  } else {
    dfs1(hvc[u], false);
    down[u] = down[hvc[u]];
  }
  for (auto& x : adj[u]) {
    if (x == anc[u][0] || x == hvc[u]) continue;
    dfs1(x, true);
  }
}
int lca(int u, int v) {
  if (rnk[u] < rnk[v]) swap(u, v);
  int d = rnk[u] - rnk[v];
  for (int i = 0; i < (LG); i++)
    if (d & (1 << i)) u = anc[u][i];
  if (u == v) return u;
  for (int i = LG - 1; i >= 0; i--)
    if (anc[u][i] != anc[v][i]) u = anc[u][i], v = anc[v][i];
  return anc[u][0];
}
struct Query {
  int X, Y;
  int s, c;
  Query() {}
  Query(int a, int b, int x, int y) : X(a), Y(b), s(x), c(y) {}
};
vector<Query> qs[N];
double ans = 1e12;
int chk[N];
void solve(int u) {
  priority_queue<tuple<rat, int, int, int> > pq;
  auto cmp = [&](int i, int j) -> bool {
    if (rat(qs[u][i].X, qs[u][i].c) < rat(qs[u][j].X, qs[u][j].c)) {
      return rat((long long)qs[u][i].c * qs[u][j].X, qs[u][j].c) <
             qs[u][j].s - qs[u][i].s + qs[u][i].X;
    } else {
      return rat(qs[u][i].s - qs[u][j].s + qs[u][j].X, 1) <
             rat((long long)qs[u][i].X * qs[u][j].c, qs[u][i].c);
    }
  };
  set<int, decltype(cmp)> st(cmp);
  int sz = qs[u].size();
  for (int i = 0; i < (sz); i++) {
    pq.push(make_tuple(rat(-qs[u][i].X, qs[u][i].c), 2, i, 0));
    pq.push(make_tuple(rat(-qs[u][i].Y, qs[u][i].c), 1, i, 0));
    chk[i] = 0;
  }
  while (!pq.empty()) {
    auto T = pq.top();
    pq.pop();
    int tp = get<1>(T);
    rat time = -get<0>(T);
    if (tp == 1) {
      int i = get<2>(T);
      chk[i] = 0;
      auto it = st.find(i);
      it = st.erase(it);
      auto it2 = it;
      if (it != st.begin()) {
        it2--;
        if (it != st.end()) {
          int i = *it;
          int j = *it2;
          if (qs[u][i].c != qs[u][j].c) {
            rat ntime = rat(qs[u][i].X - qs[u][j].X - qs[u][i].s + qs[u][j].s,
                            qs[u][i].c - qs[u][j].c);
            if (!(ntime < time)) {
              pq.push(make_tuple(-ntime, 3, i, j));
            }
          }
        }
      }
    } else if (tp == 2) {
      int i = get<2>(T);
      chk[i] = 1;
      auto P = st.insert(i);
      if (!P.second) {
        ans = min(ans, (double)time.a / time.b);
        return;
      }
      auto it2 = P.first;
      auto it = it2;
      if (it != st.begin()) {
        it2--;
        int j = *it2;
        if (qs[u][i].c != qs[u][j].c) {
          rat ntime = rat(qs[u][i].X - qs[u][j].X - qs[u][i].s + qs[u][j].s,
                          qs[u][i].c - qs[u][j].c);
          if (!(ntime < time)) {
            pq.push(make_tuple(-ntime, 3, i, j));
          }
        }
      }
      it2 = it;
      it2++;
      if (it2 != st.end()) {
        int j = *it2;
        if (qs[u][i].c != qs[u][j].c) {
          rat ntime = rat(qs[u][i].X - qs[u][j].X - qs[u][i].s + qs[u][j].s,
                          qs[u][i].c - qs[u][j].c);
          if (!(ntime < time)) {
            pq.push(make_tuple(-ntime, 3, i, j));
          }
        }
      }
    } else {
      int u = get<2>(T);
      int v = get<3>(T);
      if (!chk[u] || !chk[v]) continue;
      ans = min(ans, (double)time.a / time.b);
      return;
    }
  }
}
int main() {
  freopen("input.txt", "r", stdin);
  int n, m;
  scanf("%d%d", &(n), &(m));
  for (int i = 0; i < (n - 1); i++) {
    int a, b;
    scanf("%d%d", &(a), &(b));
    a--;
    b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  anc[0][0] = -1;
  dfs0(0);
  dfs1(0, true);
  for (int j = 1; j <= (LG - 1); j++)
    for (int i = 0; i < (n); i++) {
      int a = anc[i][j - 1];
      if (a == -1)
        anc[i][j] = -1;
      else
        anc[i][j] = anc[a][j - 1];
    }
  for (int i = 0; i < (m); i++) {
    int t, c, u, v;
    scanf("%d%d", &(t), &(c));
    scanf("%d%d", &(u), &(v));
    u--;
    v--;
    bool good = false;
    int L = lca(u, v);
    int ou = u;
    while (up[u] != up[L]) {
      int uu = up[u];
      qs[uu].emplace_back(-(c * t + rnk[ou] - rnk[u]),
                          -(c * t + rnk[ou] - rnk[uu] + 1), rnk[u], -c);
      u = anc[uu][0];
    }
    if (u != L) {
      qs[up[u]].emplace_back(-(c * t + rnk[ou] - rnk[u]),
                             -(c * t + rnk[ou] - rnk[L]), rnk[u], -c);
      good = true;
    }
    int d = rnk[ou] - rnk[L];
    while (up[v] != up[L]) {
      int vv = up[v];
      qs[vv].emplace_back(t * c + rnk[vv] - 1 - rnk[L] + d,
                          t * c + rnk[v] - rnk[L] + d, rnk[vv] - 1, c);
      v = anc[vv][0];
    }
    if (v != L) {
      good = true;
      qs[up[v]].emplace_back(t * c + d, t * c + rnk[v] - rnk[L] + d, rnk[L], c);
    }
    if (!good) {
      qs[up[L]].emplace_back(t * c + d, t * c + d, rnk[L], c);
    }
  }
  for (int i = 0; i < (n); i++) {
    if (up[i] == i) {
      solve(i);
    }
  }
  if (ans > 1e11) {
    puts("-1");
  } else
    printf("%.15f\n", ans);
  return 0;
}