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>
using namespace std;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
int n, m, fa[200005], dep[200005], son[200005], top[200005], siz[200005];
vector<int> G[200005];
struct line {
  int x, id, f;
  double t, c;
} be[200005];
double t, c[200005], ed[200005], ans = 1e10;
double calc(const line& x) { return dep[x.x] + (t - x.t) * c[x.id]; }
bool operator<(const line& a, const line& b) { return calc(a) < calc(b); }
void dfs(int x, int f) {
  fa[x] = f;
  dep[x] = dep[f] + 1;
  siz[x] = 1;
  int sizz = G[x].size();
  for (int i = 0; i < sizz; i++) {
    int v = G[x][i];
    if (v == f) continue;
    dfs(v, x);
    siz[x] += siz[v];
    if (siz[v] > siz[son[x]]) son[x] = v;
  }
}
void dfs2(int x, int fath) {
  top[x] = fath;
  int sizz = G[x].size();
  if (son[x]) dfs2(son[x], fath);
  for (int i = 0; i < sizz; i++) {
    int v = G[x][i];
    if (v == fa[x] || v == son[x]) continue;
    dfs2(v, v);
  }
}
double Get(int u, int v, double sp) {
  return (double)abs(dep[u] - dep[v]) / sp;
}
int lca(int x, int y) {
  while (top[x] != top[y]) {
    if (dep[top[y]] > dep[top[x]]) swap(x, y);
    x = fa[top[x]];
  }
  if (dep[x] < dep[y])
    return x;
  else
    return y;
}
multiset<line> st;
vector<line> h[200005];
void update(const line& x, const line& y) {
  double v = calc(y) - calc(x),
         p = fabs(v) < (double)1e-10
                 ? 0
                 : (calc(y) - calc(x)) / (c[x.id] - c[y.id]);
  if (p > -(double)1e-10 && p + t < min(ed[x.id], ed[y.id]) + (double)1e-10)
    ans = min(ans, p + t);
}
int cmp(const line& a, const line& b) {
  return fabs(a.t - b.t) < (double)1e-10 ? a.f > b.f : a.t < b.t;
}
void work(int u) {
  st.clear();
  sort(h[u].begin(), h[u].end(), cmp);
  int sizz = h[u].size();
  for (int i = 0; i < sizz; i++) {
    line x = h[u][i];
    if (x.f)
      be[x.id] = x;
    else
      ed[x.id] = x.t;
  }
  for (int i = 0; i < sizz; i++) {
    line x = h[u][i];
    if ((t = x.t) > ans + (double)1e-10) break;
    if (x.f) {
      st.insert(x);
      set<line>::iterator it = st.find(x);
      c[x.id] = x.c;
      if (it != st.begin()) update(x, *prev(it));
      if (++it != st.end()) update(x, *it);
    } else {
      set<line>::iterator it = st.find(be[x.id]);
      if (it != st.begin() && next(it) != st.end())
        update(*prev(it), *next(it));
      if (it != st.end()) st.erase(it);
    }
  }
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i < n; i++) {
    int x = read(), y = read();
    G[x].push_back(y);
    G[y].push_back(x);
  }
  dfs(1, 0);
  dfs2(1, 1);
  for (int i = 1; i <= m; i++) {
    double t = read();
    c[i] = read();
    int x = read(), y = read(), u = x, v = y, p = lca(u, v), flag = 1;
    double T = t + Get(u, p, c[i]);
    while (top[u] != top[v]) {
      if (dep[top[u]] < dep[top[v]]) swap(u, v), flag ^= 1;
      if (flag)
        h[top[u]].push_back((line){u, i, 1, t + Get(x, u, c[i]), -c[i]}),
            h[top[u]].push_back(
                (line){fa[top[u]], i, 0, t + Get(x, fa[top[u]], c[i]), -c[i]});
      else
        h[top[u]].push_back((line){u, i, 0, T + Get(u, p, c[i]), c[i]}),
            h[top[u]].push_back(
                (line){fa[top[u]], i, 1, T + Get(fa[top[u]], p, c[i]), c[i]});
      u = fa[top[u]];
    }
    if (dep[u] < dep[v]) swap(u, v), flag ^= 1;
    if (flag)
      h[top[u]].push_back((line){u, i, 1, t + Get(x, u, c[i]), -c[i]}),
          h[top[u]].push_back((line){v, i, 0, T, -c[i]});
    else
      h[top[u]].push_back((line){v, i, 1, T, c[i]}),
          h[top[u]].push_back((line){u, i, 0, T + Get(u, v, c[i]), c[i]});
  }
  for (int i = 1; i <= n; i++)
    if (top[i] == i) work(i);
  if (fabs(ans - 1e10) < (double)1e-10)
    puts("-1");
  else
    printf("%.10lf\n", ans);
  return 0;
}