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 = 2e5 + 10;
struct pi {
  long long x, y;
};
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
pi make(long long a, long long b = 1) { return (pi){a, b}; }
pi div(pi a) {
  long long d = gcd(a.x, a.y);
  d *= a.y < 0 ? -1 : 1;
  return make(a.x / d, a.y / d);
}
pi div1(long long a, long long b) { return div(make(a, b)); }
pi operator+(pi a, pi b) {
  long long z = a.y / gcd(a.y, b.y) * b.y;
  return div1(a.x * (z / a.y) + b.x * (z / b.y), z);
}
pi operator-(pi a, pi b) {
  b.x *= -1;
  return a + b;
}
pi operator*(pi a, pi b) { return div1(a.x * b.x, a.y * b.y); }
pi operator/(pi a, pi b) { return div1(a.x * b.y, a.y * b.x); }
bool operator<(pi a, pi b) {
  if ((a.y < 0) != (b.y < 0)) swap(a, b);
  return a.x * b.y < a.y * b.x;
}
bool operator==(pi a, pi b) { return a.x * b.y == a.y * b.x; }
pi now;
struct node {
  pi s;
  long long v;
};
bool operator<(node a, node b) {
  pi a1 = a.s + make(a.v) * now, b1 = b.s + make(b.v) * now;
  if (a1 == b1) {
    if (a.v == b.v) return a.s < b.s;
    return a.v < b.v;
  }
  return a1 < b1;
}
pi crash(node a, node b) {
  if (a.v == b.v) return make(1e9);
  pi res = (b.s - a.s) / make(a.v - b.v);
  if (res < now)
    return make(1e9);
  else
    return res;
}
multiset<node> s;
multiset<pi> lim;
int dfn[N], ld[N], size[N], hs[N], n, m;
int w[N], ne[N], la[N], t, fa[N], dep[N];
void link(int x, int y) {
  w[++t] = y;
  ne[t] = la[x];
  la[x] = t;
}
struct que {
  node s;
  int ty;
  pi t;
};
vector<que> vec[N];
bool comp(que a, que b) {
  if (a.t == b.t) return a.ty < b.ty;
  return a.t < b.t;
}
void dfs1(int x) {
  for (int y = la[x]; y; y = ne[y]) {
    int z = w[y];
    if (z == fa[x]) continue;
    fa[z] = x;
    dep[z] = dep[x] + 1;
    dfs1(z);
    size[x] += size[z];
    if (size[z] > size[hs[x]]) hs[x] = z;
  }
  size[x]++;
}
void dfs2(int x) {
  ld[x] = hs[fa[x]] == x ? ld[fa[x]] : x;
  for (int y = la[x]; y; y = ne[y])
    if (w[y] != fa[x]) dfs2(w[y]);
}
int lca(int x, int y) {
  while (ld[x] != ld[y]) {
    if (dep[ld[x]] < dep[ld[y]]) swap(x, y);
    x = fa[ld[x]];
  }
  return dep[x] < dep[y] ? x : y;
}
void init() {
  now = (pi){0, 1};
  node a = (node){make(-1e9), -1}, b = (node){make(1e9), 1};
  s.clear();
  s.insert(a);
  s.insert(b);
  lim.clear();
  lim.insert(crash(a, b));
}
int main() {
  cin >> n >> m;
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    link(x, y);
    link(y, x);
  }
  dfs1(1);
  dfs2(1);
  while (m--) {
    int t, c, x, y, z, d;
    scanf("%d%d%d%d", &t, &c, &x, &y);
    z = lca(x, y);
    d = dep[x] + dep[y] - 2 * dep[z];
    node s1 = (node){make(t * c + dep[x]), -c},
         s2 = (node){make(2 * dep[z] - dep[x] - t * c), c};
    pi now1 = make(t), now2 = make(t) + make(d, c);
    while (ld[x] != ld[y]) {
      if (dep[ld[x]] > dep[ld[y]]) {
        int x0 = fa[ld[x]];
        vec[ld[x]].push_back((que){s1, 1, now1});
        now1 = now1 + make(dep[x] - dep[x0], c);
        vec[ld[x]].push_back((que){s1, 2, now1});
        x = x0;
      } else {
        int y0 = fa[ld[y]];
        vec[ld[y]].push_back((que){s2, 2, now2});
        now2 = now2 - make(dep[y] - dep[y0], c);
        vec[ld[y]].push_back((que){s2, 1, now2});
        y = y0;
      }
    }
    if (dep[x] < dep[y]) {
      vec[ld[x]].push_back((que){s2, 1, now1});
      vec[ld[x]].push_back((que){s2, 2, now2});
    } else {
      vec[ld[x]].push_back((que){s1, 1, now1});
      vec[ld[x]].push_back((que){s1, 2, now2});
    }
  }
  pi ans = make(1e9);
  for (int x = 1; x <= n; x++) {
    if (ld[x] != x) continue;
    init();
    sort(vec[x].begin(), vec[x].end(), comp);
    for (auto i : vec[x]) {
      now = i.t;
      if (!(now < *lim.begin())) {
        if (*lim.begin() < ans) ans = *lim.begin();
        break;
      }
      if (i.ty == 1) {
        multiset<node>::iterator x0 = s.find(i.s);
        if (x0 != s.end()) {
          if (now < ans) ans = now;
          break;
        }
        s.insert(i.s);
        multiset<node>::iterator x = s.find(i.s), L = --s.find(i.s),
                                 R = ++s.find(i.s);
        lim.erase(lim.find(crash(*L, *R)));
        lim.insert(crash(*L, i.s));
        lim.insert(crash(*R, i.s));
      } else {
        multiset<node>::iterator x = s.find(i.s), L = --s.find(i.s),
                                 R = ++s.find(i.s);
        assert(x != s.end());
        lim.erase(lim.find(crash(*L, i.s)));
        lim.erase(lim.find(crash(*R, i.s)));
        lim.insert(crash(*L, *R));
        s.erase(s.find(i.s));
      }
    }
  }
  if (ans == make(1e9))
    cout << -1 << endl;
  else {
    ans = div(ans);
    printf("%.12lf\n", (double)ans.x / ans.y);
  }
}