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;
template <typename T>
void read(T &x) {
  x = 0;
  int fh = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x = x * fh;
}
struct shj {
  int be, en;
  long double bt, v;
};
struct Onfo {
  shj x;
  int opt;
  long double ti;
} t[100010 * 2];
struct Info {
  int nu, ne;
} a[100010 * 2];
vector<shj> g1[100010], g2[100010];
int b[100010], num, d[100010], f[100010], si[100010], so[100010], m, n, x, y, p,
    q, tp[100010], nt;
long double ansn = 1e9, nti;
multiset<shj> s;
bool operator<(shj x, shj y) {
  long double nx = x.be + (nti - x.bt) * x.v, ny = y.be + (nti - y.bt) * y.v;
  if (fabs(nx - ny) > 1e-9) return nx < ny;
  if (x.be != y.be) return x.be < y.be;
  return x.en < y.en;
}
void jb(int x, int y) {
  a[++num].nu = y;
  a[num].ne = b[x];
  b[x] = num;
}
void dfs(int x, int fa, int dep) {
  si[x] = 1;
  d[x] = dep;
  f[x] = fa;
  for (int y = b[x]; y; y = a[y].ne) {
    if (a[y].nu != fa) {
      dfs(a[y].nu, x, dep + 1);
      si[x] += si[a[y].nu];
      if (si[a[y].nu] > si[so[x]]) so[x] = a[y].nu;
    }
  }
}
void dfs1(int x) {
  if (so[x] != 0) {
    tp[so[x]] = tp[x];
    dfs1(so[x]);
  }
  for (int y = b[x]; y; y = a[y].ne)
    if (a[y].nu != so[x] && a[y].nu != f[x]) {
      tp[a[y].nu] = a[y].nu;
      dfs1(a[y].nu);
    }
}
int lca(int x, int y) {
  while (tp[x] != tp[y]) {
    if (d[tp[x]] < d[tp[y]]) swap(x, y);
    x = f[tp[x]];
  }
  if (d[x] > d[y]) swap(x, y);
  return x;
}
void get(int x, int y, long double bt, long double v) {
  int z = lca(x, y);
  long double et = bt + (d[x] + d[y] - d[z] * 2) / v;
  while (tp[x] != tp[y]) {
    if (d[tp[x]] < d[tp[y]]) {
      et -= (d[y] - d[tp[y]]) / v;
      g1[tp[y]].push_back((shj){tp[y], y, et, v});
      y = tp[y];
      et -= 1 / v;
      g2[y].push_back((shj){f[y], y, et, v});
      y = f[y];
    } else {
      g1[tp[x]].push_back((shj){x, tp[x], bt, v});
      bt += (d[x] - d[tp[x]]) / v;
      x = tp[x];
      g2[x].push_back((shj){x, f[x], bt, v});
      x = f[x];
      bt += 1 / v;
    }
  }
  g1[tp[x]].push_back((shj){x, y, bt, v});
  return;
}
bool c1(const Onfo &a, const Onfo &b) {
  if (abs(a.ti - b.ti) < 1e-9) return a.opt > b.opt;
  return a.ti < b.ti;
}
long double cr(shj x, shj y) {
  if (fabs(x.v - y.v) < 1e-9) {
    if (fabs((y.be - x.be) / x.v + x.bt - y.bt) < 1e-9) return max(x.bt, y.bt);
    return 1e9;
  } else {
    long double ny = (x.bt - y.bt) * y.v + y.be;
    long double ant = x.bt + (ny - x.be) / (x.v - y.v);
    if (ant > x.bt - 1e-9 && ant > y.bt - 1e-9 &&
        ant < x.bt + (x.en - x.be) / x.v + 1e-9 &&
        ant < y.bt + (y.en - y.be) / y.v + 1e-9)
      return ant;
    return 1e9;
  }
}
void work(vector<shj> x) {
  nt = 0;
  for (auto i : x) {
    if (i.be > i.en) i.v = -i.v;
    t[++nt].x = i;
    t[nt].ti = i.bt;
    t[++nt].x = i;
    t[nt].ti = i.bt + (i.en - i.be) / i.v;
    t[nt].opt = -1;
    t[nt - 1].opt = 1;
  }
  sort(t + 1, t + nt + 1, c1);
  s.clear();
  for (int i = 1; i <= nt; i++) {
    nti = t[i].ti;
    if (nti > ansn - 1e-9) return;
    if (t[i].opt == 1) {
      s.insert(t[i].x);
      auto j = s.lower_bound(t[i].x);
      auto k = j;
      if (k != s.begin()) {
        k--;
        ansn = min(ansn, cr(*k, *j));
      }
      k = j;
      k++;
      if (k != s.end()) ansn = min(ansn, cr(*j, *k));
    } else {
      auto j = s.lower_bound(t[i].x);
      auto q = j, p = j;
      if (q != s.begin() && ++p != s.end()) {
        q--;
        ansn = min(ansn, cr(*q, *p));
      }
      s.erase(j);
    }
  }
}
int main() {
  read(n);
  read(m);
  for (int i = 1; i < n; i++) {
    read(x);
    read(y);
    jb(x, y);
    jb(y, x);
  }
  dfs(1, 0, 1);
  tp[1] = 1;
  dfs1(1);
  for (int i = 1; i <= m; i++) {
    read(p);
    read(q);
    read(x);
    read(y);
    get(x, y, p, q);
  }
  for (int i = 1; i <= n; i++) {
    for (unsigned j = 0; j < g1[i].size(); j++) {
      g1[i][j].be = d[g1[i][j].be] - d[i];
      g1[i][j].en = d[g1[i][j].en] - d[i];
    }
    for (unsigned j = 0; j < g2[i].size(); j++) {
      g2[i][j].be = d[g2[i][j].be] - d[i];
      g2[i][j].en = d[g2[i][j].en] - d[i];
    }
    work(g1[i]);
    work(g2[i]);
  }
  if (abs(ansn - 1e9) <= 1e-9)
    puts("-1");
  else
    printf("%.10Lf\n", ansn);
  return 0;
}