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 <class T>
inline void chkmin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline void chkmax(T &a, T b) {
  if (a < b) a = b;
}
inline int read() {
  int s = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') ch = getchar(), f = -1;
  while (isdigit(ch)) s = s * 10 + ch - '0', ch = getchar();
  return ~f ? s : -s;
}
const int maxn = 1e5 + 20;
struct node {
  int v, next;
};
node e[maxn << 1];
int cnt, start[maxn];
inline void addedge(int u, int v) {
  e[++cnt] = (node){v, start[u]};
  start[u] = cnt;
}
int deep[maxn], son[maxn], fa[maxn], sz[maxn], top[maxn], dfn[maxn], low[maxn],
    times, down[maxn];
int n, m;
void dfs(int u) {
  sz[u] = 1;
  for (int i = start[u]; i; i = e[i].next) {
    int v = e[i].v;
    if (v == fa[u]) continue;
    deep[v] = deep[u] + 1;
    fa[v] = u;
    dfs(v);
    sz[u] += sz[v];
    if (sz[son[u]] < sz[v]) son[u] = v;
  }
}
void dfs1(int u) {
  dfn[u] = ++times;
  if (son[u])
    top[son[u]] = top[u], dfs1(son[u]), down[u] = down[son[u]];
  else
    down[u] = deep[u];
  for (int i = start[u]; i; i = e[i].next) {
    int v = e[i].v;
    if (v == fa[u] || v == son[u]) continue;
    top[v] = v;
    dfs1(v);
  }
}
inline int lca(int u, int v) {
  while (top[u] != top[v]) {
    if (deep[top[u]] > deep[top[v]]) swap(u, v);
    v = fa[top[v]];
  }
  if (deep[u] > deep[v]) swap(u, v);
  return u;
}
inline void init() {
  n = read();
  m = read();
  for (int i = (1), _end_ = (n - 1); i <= _end_; i++) {
    int u = read(), v = read();
    addedge(u, v);
    addedge(v, u);
  }
  deep[1] = 1;
  dfs(1);
  top[1] = 1;
  dfs1(1);
}
const double eps = 1e-9;
struct line {
  double k, b;
  double t1, t2;
  int id;
};
inline double Intersection(line l1, line l2) {
  if (l1.k == l2.k) {
    if (fabs(l1.b - l2.b) < eps)
      return max(l1.t1, l2.t1);
    else
      return 1e18;
  }
  return (l1.b - l2.b) / (l2.k - l1.k);
}
vector<line> num[maxn];
double ans;
struct Modify {
  double pos;
  int op, id;
};
Modify md[maxn << 3];
int mtot;
double NOW;
struct cmp {
  inline bool operator()(line a, line b) const {
    return a.k * NOW + a.b == b.k * NOW + b.b
               ? a.id < b.id
               : a.k * NOW + a.b < b.k * NOW + b.b;
  }
};
set<line, cmp> s;
set<line, cmp>::iterator it, itt, ittt;
inline void solve(int id) {
  double tmp = 1e18;
  vector<line> f;
  f = num[id];
  for (int i = (0), _end_ = (((int)f.size()) - 1); i <= _end_; i++) f[i].id = i;
  mtot = 0;
  for (int i = (0), _end_ = (((int)f.size()) - 1); i <= _end_; i++)
    md[++mtot] = (Modify){f[i].t1, 1, i}, md[++mtot] = (Modify){f[i].t2, -1, i};
  sort(md + 1, md + 1 + mtot, [](Modify a, Modify b) {
    return fabs(a.pos - b.pos) < eps ? a.op > b.op : a.pos < b.pos;
  });
  s.clear();
  for (int i = (1), _end_ = (mtot); i <= _end_; i++) {
    NOW = md[i].pos;
    if (NOW - eps >= tmp) return;
    int id = md[i].id;
    if (md[i].op == 1) {
      s.insert(f[id]);
      it = s.lower_bound(f[id]);
      if (it != s.begin()) {
        itt = it;
        itt--;
        double sect = Intersection(*itt, *it);
        if (sect >= NOW - eps && sect - eps <= it->t2 && sect - eps <= itt->t2)
          chkmin(tmp, sect), chkmin(ans, sect);
      }
      if (it != (--s.end())) {
        itt = it;
        itt++;
        double sect = Intersection(*itt, *it);
        if (sect >= NOW - eps && sect - eps <= it->t2 && sect - eps <= itt->t2)
          chkmin(tmp, sect), chkmin(ans, sect);
      }
    } else {
      it = s.lower_bound(f[id]);
      if (it != s.begin() && it != (--s.end())) {
        itt = it;
        itt--;
        it++;
        double sect = Intersection(*itt, *it);
        if (sect >= NOW - eps && sect - eps <= it->t2 && sect - eps <= itt->t2)
          chkmin(tmp, sect), chkmin(ans, sect);
      }
      s.erase(f[id]);
    }
  }
}
inline void doing() {
  for (int i = (1), _end_ = (m); i <= _end_; i++) {
    double tim, times;
    scanf("%lf", &tim);
    int c = read(), u = read(), v = read(), t = lca(u, v);
    int DIS = (deep[u] + deep[v] - deep[t] * 2);
    times = tim;
    line now;
    int dis;
    while (top[u] != top[t]) {
      dis = deep[u] - deep[top[u]] + 1;
      now.k = c;
      now.b = down[u] - deep[u] - times * c;
      now.t1 = times;
      times += (1. * dis / c);
      now.t2 = times;
      num[top[u]].push_back(now);
      u = fa[top[u]];
    }
    dis = deep[u] - deep[t];
    now.k = c;
    now.b = down[u] - deep[u] - times * c;
    now.t1 = times;
    times += (1. * dis / c);
    now.t2 = times;
    num[top[u]].push_back(now);
    times = tim + DIS * 1. / c;
    while (top[v] != top[t]) {
      dis = deep[v] - deep[top[v]] + 1;
      now.k = -c;
      now.b = down[v] - deep[v] + times * c;
      now.t2 = times;
      times -= dis * 1. / c;
      now.t1 = times;
      num[top[v]].push_back(now);
      v = fa[top[v]];
    }
    dis = deep[v] - deep[t];
    now.k = -c;
    now.b = down[v] - deep[v] + times * c;
    now.t2 = times + 1e-8;
    times -= dis * 1. / c;
    now.t1 = times + 1e-8;
    num[top[v]].push_back(now);
    v = fa[top[v]];
  }
  ans = 1e18;
  for (int i = (1), _end_ = (n); i <= _end_; i++)
    if (((int)num[i].size()) > 0) solve(i);
  if (ans != 1e18)
    printf("%.8lf\n", ans);
  else
    puts("-1");
}
int main() {
  init();
  doing();
  return 0;
}