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 = 100005;
const long double eps = 1e-10;
int read() {
  int f = 1, g = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) g = g * 10 + ch - '0';
  return f * g;
}
int n, m, depth[N], size[N], hs[N], fa[N][21];
int ccnt, chtop[N], bel[N];
long double ans, T;
struct node {
  int k, b, l, r;
  node(int _k, int _b, int x, int y) {
    k = _k;
    b = _b;
    l = min(x, y);
    r = max(x, y);
  }
  void print() { printf("%d %d %d %d\n", k, b, l, r); }
};
bool operator<(node a, node b) {
  long double t1 = a.k * T + a.b, t2 = b.k * T + b.b;
  return t1 < t2;
  if (a.k != b.k) return a.k < b.k;
  if (a.b != b.b) return a.b < b.b;
  return (a.l != b.l) ? (a.l < b.l) : (a.r < b.r);
}
vector<int> e[N];
vector<node> b[N], a;
long double check(node a, node b) {
  int k = a.k - b.k, t = b.b - a.b;
  long double ret;
  if (!k) {
    if (t != 0) return 1e18;
    long double t1 = min((a.l - a.b) / (long double)a.k,
                         (a.r - a.b) / (long double)a.k),
                t2 = min((b.l - b.b) / (long double)b.k,
                         (b.r - b.b) / (long double)b.k);
    ret = max(t1, t2);
  } else {
    long double pos = (long long)a.k * t / (long double)k + a.b;
    ret = ((a.l <= pos + eps) && (a.r >= pos - eps) && (b.l <= pos + eps) &&
           (b.r >= pos - eps))
              ? (t / (long double)k)
              : 1e18;
  }
  return ret;
}
void build(int x, int fath) {
  size[x] = 1;
  hs[x] = 0;
  depth[x] = depth[fath] + 1;
  fa[x][0] = fath;
  for (int i = 1; i < 20; i++) fa[x][i] = fa[fa[x][i - 1]][i - 1];
  for (auto y : e[x])
    if (y != fath) {
      build(y, x);
      size[x] += size[y];
      if (size[y] > size[hs[x]]) hs[x] = y;
    }
}
void build2(int x, int fath) {
  bel[x] = ccnt;
  if (hs[x]) build2(hs[x], x);
  for (auto y : e[x])
    if ((y != fath) && (y != hs[x])) {
      chtop[++ccnt] = y;
      build2(y, x);
    }
}
int lca(int x, int y) {
  if (depth[x] < depth[y]) swap(x, y);
  for (int i = 19; i >= 0; i--)
    if (depth[fa[x][i]] >= depth[y]) x = fa[x][i];
  if (x == y) return x;
  for (int i = 19; i >= 0; i--)
    if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];
  return fa[x][0];
}
void work(int x, int y, int k, int b1, int b2) {
  while (bel[x] != bel[y]) {
    if (depth[chtop[bel[x]]] < depth[chtop[bel[y]]]) {
      swap(x, y);
      swap(b1, b2);
      k = -k;
    }
    b[bel[x]].push_back(node(k, b1, depth[chtop[bel[x]]] - 1, depth[x]));
    x = fa[chtop[bel[x]]][0];
  }
  if (depth[x] < depth[y]) {
    swap(x, y);
    swap(b1, b2);
    k = -k;
  }
  b[bel[x]].push_back(node(k, b1, depth[x], depth[y]));
}
vector<pair<long double, int> > g;
multiset<node> h;
long double calc() {
  long double ans = 1e18;
  g.clear();
  for (int i = 0; i < (int)a.size(); i++) {
    long double tl = (long double)(a[i].l - a[i].b) / a[i].k,
                tr = (long double)(a[i].r - a[i].b) / a[i].k;
    if (tl > tr) swap(tl, tr);
    g.push_back(make_pair(tl, i + 1));
    g.push_back(make_pair(tr + eps, -i - 1));
  }
  sort(g.begin(), g.end());
  h.clear();
  int i;
  multiset<node>::iterator it, itl;
  for (auto t : g) {
    T = t.first;
    i = abs(t.second) - 1;
    if (T >= ans - eps) return ans;
    if (t.second > 0) {
      it = h.lower_bound(a[i]);
      if (it != h.end()) ans = min(ans, check(*it, a[i]));
      if (it != h.begin()) {
        it--;
        ans = min(ans, check(*it, a[i]));
      }
      h.insert(a[i]);
    } else {
      it = h.lower_bound(a[i]);
      if (it == h.end()) {
        a[i].print();
        printf("%.12Lf %.12Lf\n", T, ans);
        for (auto t : h) t.print();
        it--;
      }
      h.erase(it);
      itl = h.lower_bound(a[i]);
      if ((itl != h.end()) && (itl != h.begin())) {
        it = itl;
        itl--;
        ans = min(ans, check(*it, *itl));
      }
    }
  }
  return ans;
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i < n; i++) {
    int u = read(), v = read();
    e[u].push_back(v);
    e[v].push_back(u);
  }
  build(1, 0);
  chtop[++ccnt] = 1;
  build2(1, 0);
  while (m--) {
    int t = read(), k = read(), x = read(), y = read(), z = lca(x, y);
    if (k == 0) k = 1;
    int b = depth[x] + k * t;
    work(x, y, -k, b, depth[z] - (b - depth[z]));
  }
  ans = 1e18;
  for (int i = 1; i <= ccnt; i++) {
    swap(a, b[i]);
    ans = min(ans, calc());
  }
  if (ans < 1e16)
    printf("%.8Lf\n", ans);
  else
    puts("-1");
  return 0;
}