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;
const int N = 1e5 + 10;
const double eps = 1e-10;
int rd() {
  int x = 0, w = 1;
  char ch = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch ^ 48);
    ch = getchar();
  }
  return x * w;
}
int to[N << 1], nt[N << 1], hd[N], tot = 1;
void adde(int x, int y) {
  ++tot, to[tot] = y, nt[tot] = hd[x], hd[x] = tot;
  ++tot, to[tot] = x, nt[tot] = hd[y], hd[y] = tot;
}
int n, m, fa[N], de[N], sz[N], hs[N], dfn[N], ti, top[N];
void dfs1(int x) {
  sz[x] = 1;
  for (int i = hd[x]; i; i = nt[i]) {
    int y = to[i];
    if (y == fa[x]) continue;
    fa[y] = x, de[y] = de[x] + 1, dfs1(y);
    sz[x] += sz[y], hs[x] = sz[hs[x]] > sz[y] ? hs[x] : y;
  }
}
void dfs2(int x) {
  dfn[x] = ++ti;
  if (hs[x]) top[hs[x]] = top[x], dfs2(hs[x]);
  for (int i = hd[x]; i; i = nt[i]) {
    int y = to[i];
    if (y == fa[x] || y == hs[x]) continue;
    top[y] = y, dfs2(y);
  }
}
int glca(int x, int y) {
  while (top[x] != top[y]) {
    if (de[top[x]] < de[top[y]]) swap(x, y);
    x = fa[top[x]];
  }
  return de[x] < de[y] ? x : y;
}
int tz;
double ps[N * 30][2], pt, ans = 114514;
struct node {
  double x, k, b;
  int i, o;
  bool operator<(const node &bb) const {
    double s1 = k * pt + b, s2 = bb.k * pt + bb.b;
    if (fabs(s1 - s2) > eps) return s1 < s2;
    if (fabs(x - bb.x) > eps) return x < bb.x;
    if (o != bb.o) return o < bb.o;
    return i < bb.i;
  }
  double s(double x) { return k * x + b; }
} bz[N * 30];
bool cmp(node aa, node bb) {
  return fabs(aa.x - bb.x) > eps ? aa.x < bb.x : aa.o > bb.o;
}
vector<node> qr[N];
void addq(int x, double xl, double xr, double yl, double yr) {
  ps[++tz][0] = xl, ps[tz][1] = xr;
  double nk = fabs(xl - xr) > eps ? (yr - yl) / (xr - xl) : 1,
         nb = yl - nk * xl;
  qr[top[x]].push_back((node){xl, nk, nb, tz, 1});
  qr[top[x]].push_back((node){xr, nk, nb, tz, 0});
}
multiset<node> sb;
multiset<node>::iterator it, ft, nx;
void cal(int i, int j) {
  if (max(ps[i][0], ps[j][0]) > min(ps[i][1], ps[j][1]) + eps) return;
  if (fabs(bz[i].k - bz[j].k) < eps) {
    if (fabs(bz[i].b - bz[j].b) > eps) return;
    ans = min(ans, max(ps[i][0], ps[j][0]));
    return;
  }
  if (fabs(bz[j].s(pt) - bz[i].s(pt)) < eps) {
    ans = min(ans, pt);
    return;
  }
  double nv = bz[i].k < bz[j].k
                  ? -1
                  : pt + (bz[j].s(pt) - bz[i].s(pt)) / (bz[i].k - bz[j].k);
  if (nv > max(ps[i][0], ps[j][0]) - eps && nv < min(ps[i][1], ps[j][1]) + eps)
    ans = min(ans, nv);
}
int main() {
  n = rd(), m = rd();
  for (int i = 1; i < n; ++i) adde(rd(), rd());
  de[1] = 1, dfs1(1);
  top[1] = 1, dfs2(1);
  while (m--) {
    double t = rd(), v = rd();
    v = 1 / v;
    int x = rd(), y = rd(), lca = glca(x, y);
    bool fg = 0;
    double xl, xr, yl, yr, lt = t + v * (double)(de[x] + de[y] - 2 * de[lca]);
    while (top[x] != top[lca]) {
      xl = t, xr = t + v * (double)(de[x] - de[fa[top[x]]]), yl = dfn[x],
      yr = (double)dfn[top[x]] - 1;
      addq(x, xl, xr, yl, yr);
      t = xr, x = fa[top[x]];
    }
    if (de[lca] < de[x]) {
      xl = t, xr = t + v * (double)(de[x] - de[lca]), yl = dfn[x],
      yr = dfn[lca];
      fg = 1, addq(lca, xl, xr, yl, yr);
    }
    t = lt;
    while (top[y] != top[lca]) {
      xl = t - v * (double)(de[y] - de[fa[top[y]]]), xr = t,
      yl = (double)dfn[top[y]] - 1, yr = dfn[y];
      addq(y, xl, xr, yl, yr);
      t = xl, y = fa[top[y]];
    }
    if (de[lca] < de[y]) {
      xl = t - v * (double)(de[y] - de[lca]), xr = t, yl = dfn[lca],
      yr = dfn[y];
      fg = 1, addq(lca, xl, xr, yl, yr);
    }
    if (!fg) addq(top[lca], t, t, dfn[lca], dfn[lca]);
  }
  for (int x = 1; x <= n; ++x) {
    int tq = qr[x].size();
    if (!tq) continue;
    sort(qr[x].begin(), qr[x].end(), cmp);
    sb.clear();
    for (int i = 0; i < tq; ++i) {
      pt = qr[x][i].x;
      if (pt > ans - eps) break;
      int j = qr[x][i].i, k = 0, l = 0;
      if (qr[x][i].o) {
        bz[j] = (node){pt, qr[x][i].k, qr[x][i].b, j, 1};
        it = sb.insert(bz[j]);
        if (it != sb.begin()) ft = it, k = (*(--ft)).i, cal(k, j);
        if (it != (--sb.end())) nx = it, l = (*(++nx)).i, cal(j, l);
      } else {
        it = sb.find(bz[j]);
        assert((*it).i == j);
        if (it != sb.begin()) ft = it, k = (*(--ft)).i;
        if (it != (--sb.end())) nx = it, l = (*(++nx)).i;
        if (k && l) cal(k, l);
        sb.erase(it);
      }
    }
  }
  ans < 114514 ? printf("%.8lf\n", ans) : puts("-1");
  return 0;
}