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;
struct Type {
  double x, X, k, b;
  int s;
} c[300001];
vector<Type> b[100001];
int a[200001][2], ls[100001], d[100001], fa[100001][17], top[100001],
    nx[100001], sz[100001], n, m, i, j, k, l, len, x, y, Lca, tot;
double T, C, ans, sum, s1, s2, tt;
struct type {
  double x1, x2, k, b;
};
bool operator<(type a, type b) { return a.k * tt + a.b < b.k * tt + b.b; }
set<type> st;
set<type>::iterator I1, I2;
bool cmp(Type a, Type b) {
  return ((a.x - b.x) > 0 ? (a.x - b.x) : -(a.x - b.x)) > 0.00000001 &&
             a.x < b.x ||
         ((a.x - b.x) > 0 ? (a.x - b.x) : -(a.x - b.x)) <= 0.00000001 &&
             a.s > b.s;
}
void New(int x, int y) {
  ++len;
  a[len][0] = y;
  a[len][1] = ls[x];
  ls[x] = len;
}
void dfs(int Fa, int t) {
  int i, mx = 0;
  sz[t] = 1, d[t] = d[Fa] + 1;
  fa[t][0] = Fa;
  for (i = 1; i <= 16; i++) fa[t][i] = fa[fa[t][i - 1]][i - 1];
  for (i = ls[t]; i; i = a[i][1])
    if (a[i][0] != Fa) {
      dfs(t, a[i][0]);
      sz[t] += sz[a[i][0]];
      if (sz[a[i][0]] > mx) mx = sz[a[i][0]], nx[t] = a[i][0];
    }
}
void Dfs(int Fa, int t) {
  int i;
  if (nx[t]) top[nx[t]] = top[t], Dfs(t, nx[t]);
  for (i = ls[t]; i; i = a[i][1])
    if (a[i][0] != Fa && a[i][0] != nx[t])
      top[a[i][0]] = a[i][0], Dfs(t, a[i][0]);
}
void swap(int &x, int &y) {
  int z = x;
  x = y;
  y = z;
}
int lca(int x, int y) {
  int i;
  if (d[x] < d[y]) swap(x, y);
  for (i = 16; i >= 0; i--)
    if (d[fa[x][i]] >= d[y]) x = fa[x][i];
  for (i = 16; i >= 0; i--)
    if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];
  if (x != y) x = fa[x][0];
  return x;
}
void add(int t, double X1, double X2, double Y1, double Y2) {
  if (((X1 - X2) > 0 ? (X1 - X2) : -(X1 - X2)) <= 0.00000001) {
    b[t].push_back({X1, X1, 0, Y1, 1});
    b[t].push_back({X1, X1, 0, Y1, -1});
    return;
  }
  double k = (Y2 - Y1) / (X2 - X1);
  b[t].push_back({X1, X2, k, Y1 - k * X1, 1});
  b[t].push_back({X2, X1, k, Y1 - k * X1, -1});
}
void js(type a, type b) {
  double x, X1, X2;
  if (((a.k - b.k) > 0 ? (a.k - b.k) : -(a.k - b.k)) <= 0.00000001) {
    if (((a.b - b.b) > 0 ? (a.b - b.b) : -(a.b - b.b)) <= 0.00000001) {
      X1 = (a.x1 > b.x1 ? a.x1 : b.x1), X2 = (a.x2 < b.x2 ? a.x2 : b.x2);
      if (((X1 - X2) > 0 ? (X1 - X2) : -(X1 - X2)) <= 0.00000001 || X1 < X2)
        ans = (ans < X1 ? ans : X1);
    }
    return;
  }
  x = (a.b - b.b) / (b.k - a.k), X1 = (a.x1 > b.x1 ? a.x1 : b.x1),
  X2 = (a.x2 < b.x2 ? a.x2 : b.x2);
  if ((((x - X1) > 0 ? (x - X1) : -(x - X1)) <= 0.00000001 || X1 < x) &&
      (((x - X2) > 0 ? (x - X2) : -(x - X2)) <= 0.00000001 || x < X2))
    ans = (ans < x ? ans : x);
}
void work(int t) {
  type s1, s2, C;
  int i, j, k, l;
  tot = 0, l = b[t].size();
  for (i = 0; i <= l - 1; i++) c[++tot] = b[t][i];
  sort(c + 1, c + tot + 1, cmp);
  tt = c[1].x;
  st.clear();
  for (i = 1; i <= tot; i++)
    if (((c[i].x - ans) > 0 ? (c[i].x - ans) : -(c[i].x - ans)) > 0.00000001 &&
        c[i].x < ans) {
      tt = c[i].x, I2 = st.upper_bound({0, 0, c[i].k, c[i].b});
      if (c[i].s == 1) {
        C = {c[i].x, c[i].X, c[i].k, c[i].b};
        if (I2 != st.end()) s2 = *I2, js(C, s2);
        if (I2 != st.begin()) --I2, s2 = *I2, js(C, s2);
        st.insert(C);
      } else {
        C = {c[i].X, c[i].x, c[i].k, c[i].b};
        if (I2 != st.begin() && I2 != st.end())
          I1 = I2, --I1, s1 = *I1, s2 = *I2, js(s1, s2);
        st.erase(C);
      }
    } else
      break;
}
int main() {
  scanf("%d%d", &n, &m), ans = 2147483647;
  for (i = 1; i <= n - 1; i++) scanf("%d%d", &j, &k), New(j, k), New(k, j);
  dfs(0, 1), top[1] = 1, Dfs(0, 1);
  for (i = 1; i <= m; i++) {
    scanf("%lf%lf%d%d", &T, &C, &x, &y),
        Lca = lca(x, y), sum = d[x] + d[y] - d[Lca] * 2, s1 = s2 = 0;
    while (1) {
      if (top[x] == top[y]) {
        if (x == y)
          add(top[x], T + s1 / C, T + s1 / C, d[x], d[x]);
        else
          add(top[x], T + s1 / C, T + (sum - s2) / C, d[x], d[y]);
        break;
      } else if (d[top[x]] > d[top[y]])
        j = fa[top[x]][0],
        add(top[x], T + s1 / C, T + (s1 + (d[x] - d[j])) / C, d[x], d[j]),
        s1 += d[x] - d[j], x = j;
      else
        j = fa[top[y]][0],
        add(top[y], T + (sum - (s2 + (d[y] - d[j]))) / C, T + (sum - s2) / C,
            d[j], d[y]),
        s2 += d[y] - d[j], y = j;
    }
  }
  for (i = 1; i <= n; i++)
    if (!b[i].empty()) work(i);
  if (ans > 1000000000)
    printf("-1\n");
  else
    printf("%.20lf\n", ans);
  fclose(stdin);
  fclose(stdout);
  return 0;
}