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 double inf = 1e9;
const double eps = 1e-8;
double T;
struct line {
  int s, t;
  double v, x;
};
struct node {
  int s;
  vector<line> v;
} a[100002];
struct event {
  line l;
  double x;
  int op;
} q[100002 * 2];
bool operator<(line a, line b) {
  double ya = 1.0 * a.s + (T - a.x) * a.v;
  double yb = 1.0 * b.s + (T - b.x) * b.v;
  if (fabs(ya - yb) != 0) return ya < yb;
  if (fabs(a.v - b.v) != 0) return a.v < b.v;
  if (a.s != b.s) return a.s < b.s;
  return a.t < b.t;
}
int head[100002], ver[100002 * 2], nxt[100002 * 2], l;
int n, m, i, j, cnt, size[100002], son[100002], fa[100002], dep[100002],
    top[100002], id[100002];
multiset<line> s;
int read() {
  char c = getchar();
  int w = 0;
  while (c < '0' || c > '9') c = getchar();
  while (c <= '9' && c >= '0') {
    w = w * 10 + c - '0';
    c = getchar();
  }
  return w;
}
void insert(int x, int y) {
  l++;
  ver[l] = y;
  nxt[l] = head[x];
  head[x] = l;
}
void dfs1(int x, int pre) {
  dep[x] = dep[pre] + 1;
  size[x] = 1;
  fa[x] = pre;
  for (int i = head[x]; i; i = nxt[i]) {
    int y = ver[i];
    if (y != pre) {
      dfs1(y, x);
      size[x] += size[y];
      if (size[y] > size[son[x]]) son[x] = y;
    }
  }
}
void dfs2(int x, int t) {
  top[x] = t;
  if (top[x] == x) {
    cnt++;
    id[x] = cnt;
    if (x == 1)
      a[cnt].s = 1;
    else
      a[cnt].s = fa[x];
  } else
    id[x] = id[top[x]];
  if (son[x] != 0) dfs2(son[x], t);
  for (int i = head[x]; i; i = nxt[i]) {
    int y = ver[i];
    if (y != son[x] && y != fa[x]) dfs2(y, y);
  }
}
int LCA(int u, int v) {
  while (top[u] != top[v]) {
    if (dep[top[u]] < dep[top[v]]) swap(u, v);
    u = fa[top[u]];
  }
  if (dep[u] > dep[v]) swap(u, v);
  return u;
}
void add(int s, int t, int x, int v) {
  int dis = dep[s] + dep[t] - 2 * dep[LCA(s, t)];
  double et = 1.0 * x + 1.0 * dis / v, st = x;
  while (top[s] != top[t]) {
    if (dep[top[s]] > dep[top[t]]) {
      int c = id[s];
      line tmp;
      tmp.s = dep[s] - dep[a[c].s];
      tmp.t = 0;
      tmp.x = st;
      tmp.v = -v;
      a[c].v.push_back(tmp);
      st += 1.0 * (dep[s] - dep[a[c].s]) / v;
      s = fa[top[s]];
    } else {
      int c = id[t];
      line tmp;
      et -= 1.0 * (dep[t] - dep[a[c].s]) / v;
      tmp.s = 0;
      tmp.t = dep[t] - dep[a[c].s];
      tmp.x = et;
      tmp.v = v;
      a[c].v.push_back(tmp);
      t = fa[top[t]];
    }
  }
  if (dep[s] > dep[t]) {
    int c = id[s];
    line tmp;
    tmp.s = dep[s] - dep[a[c].s];
    tmp.t = dep[t] - dep[a[c].s];
    tmp.x = st;
    tmp.v = -v;
    a[c].v.push_back(tmp);
  } else {
    int c = id[t];
    line tmp;
    et -= 1.0 * (dep[t] - dep[s]) / v;
    tmp.s = dep[s] - dep[a[c].s];
    tmp.t = dep[t] - dep[a[c].s];
    tmp.x = et;
    tmp.v = v;
    a[c].v.push_back(tmp);
  }
}
double cal(line a, line b) {
  if (fabs(a.v - b.v) > eps) {
    double yb = 1.0 * b.s + (a.x - b.x) * b.v;
    double ans = a.x + (yb - a.s) / (a.v - b.v);
    if (ans > a.x - eps && ans > b.x - eps &&
        a.x + 1.0 * (a.t - a.s) / a.v + eps > ans &&
        b.x + 1.0 * (b.t - b.s) / b.v + eps > ans)
      return ans;
    return inf;
  } else {
    if (fabs(1.0 * (b.s - a.s) / a.v + a.x - b.x) == 0) return max(a.x, b.x);
    return inf;
  }
}
int my_comp(const event &a, const event &b) {
  if (fabs(a.x - b.x) > eps) return a.x < b.x;
  return a.op > b.op;
}
int main() {
  n = read();
  m = read();
  for (i = 1; i < n; i++) {
    int u = read(), v = read();
    insert(u, v);
    insert(v, u);
  }
  dfs1(1, 0);
  dfs2(1, 1);
  for (i = 1; i <= m; i++) {
    int x = read(), v = read(), s = read(), t = read();
    add(s, t, x, v);
  }
  double ans = inf;
  for (i = 1; i <= cnt; i++) {
    int num = 0;
    for (j = 0; j < a[i].v.size(); j++) {
      q[++num] = (event){a[i].v[j], a[i].v[j].x, 1};
      q[++num] = (event){
          a[i].v[j],
          a[i].v[j].x + 1.0 * (a[i].v[j].t - a[i].v[j].s) / a[i].v[j].v, -1};
    }
    sort(q + 1, q + num + 1, my_comp);
    s.clear();
    for (j = 1; j <= num; j++) {
      T = q[j].x;
      if (T > ans - eps) break;
      if (q[j].op == 1) {
        s.insert(q[j].l);
        multiset<line>::iterator it = s.lower_bound(q[j].l);
        multiset<line>::iterator nxt = it, pre = it;
        nxt++;
        if (nxt != s.end()) ans = min(ans, cal((*nxt), q[j].l));
        if (pre != s.begin()) {
          pre--;
          ans = min(ans, cal((*pre), q[j].l));
        }
      } else {
        s.erase(s.find(q[j].l));
        multiset<line>::iterator it = s.lower_bound(q[j].l);
        if (it != s.end() && it != s.begin()) {
          multiset<line>::iterator pre = it;
          pre--;
          ans = min(ans, cal((*it), (*pre)));
        }
      }
    }
  }
  if (ans >= inf)
    puts("-1");
  else
    printf("%.8lf\n", ans);
  return 0;
}