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;
double nowt;
int sgn(double x) { return x > 1e-10 ? 1 : (x < -1e-10 ? -1 : 0); }
struct node {
  int stp, vel;
  double stt, edt;
  node() {}
  node(int a, int b, double c, double d) { stp = a, vel = b, stt = c, edt = d; }
  bool operator<(const node &p) const {
    double x1 = stp + (nowt - stt) * vel;
    double x2 = p.stp + (nowt - p.stt) * p.vel;
    return x1 < x2;
  }
  bool operator!=(const node &p) const {
    double x1 = stp + (nowt - stt) * vel;
    double x2 = p.stp + (nowt - p.stt) * p.vel;
    return x1 != x2;
  }
};
struct event {
  int typ, id;
  double tme;
  event() {}
  event(int a, int b, double c) { typ = a, id = b, tme = c; }
  bool operator<(const event &p) const {
    return tme < p.tme || (tme == p.tme && typ < p.typ);
  }
};
int n, m, tot;
int hd[100009], eg[200009], nxt[200009];
int f[100009][19];
int dep[100009], son[100009], sz[100009], top[100009];
vector<node> qry[100009], outv;
struct cmp {
  bool operator()(const int &a, const int &b) {
    return a == b ? 0 : (outv[a] != outv[b] ? outv[a] < outv[b] : a < b);
  }
};
void ins(int a, int b) {
  eg[++tot] = b;
  nxt[tot] = hd[a];
  hd[a] = tot;
}
void dfs1(int x, int fa) {
  sz[x] = 1;
  dep[x] = dep[fa] + 1;
  f[x][0] = fa;
  for (int i = 1; i <= 18; i++) f[x][i] = f[f[x][i - 1]][i - 1];
  for (int i = hd[x]; i; i = nxt[i])
    if (eg[i] != fa) {
      dfs1(eg[i], x);
      sz[x] += sz[eg[i]];
      if (sz[eg[i]] > sz[son[x]]) son[x] = eg[i];
    }
}
void dfs2(int x, int tp) {
  top[x] = tp;
  if (son[x]) dfs2(son[x], tp);
  for (int i = hd[x]; i; i = nxt[i])
    if (eg[i] != f[x][0] && eg[i] != son[x]) dfs2(eg[i], eg[i]);
}
int getlca(int a, int b) {
  if (dep[a] < dep[b]) swap(a, b);
  int l = dep[a] - dep[b];
  for (int i = 0; i <= 18; i++)
    if (l & (1 << i)) a = f[a][i];
  if (a == b) return a;
  for (int i = 18; i >= 0; i--)
    if (f[a][i] != f[b][i]) a = f[a][i], b = f[b][i];
  return f[a][0];
}
double cal(node a, node b) {
  if (a.stt > b.stt) swap(a, b);
  double astp = a.stp + (b.stt - a.stt) * a.vel;
  if (sgn(astp - b.stp) == 0) {
    return b.stt;
  }
  if (a.vel == b.vel) return 1e300;
  double tme = (astp - b.stp) / (b.vel - a.vel);
  if (sgn(tme) < 0) return 1e300;
  tme += b.stt;
  if (sgn(a.edt - tme) >= 0 && sgn(b.edt - tme) >= 0) return tme;
  return 1e300;
}
double solve(vector<node> &vp) {
  outv = vp;
  double ans = 1e300;
  vector<event> e;
  for (int i = 0; i < (int)vp.size(); i++) {
    e.push_back(event(0, i, vp[i].stt));
    e.push_back(event(1, i, vp[i].edt));
  }
  sort(e.begin(), e.end());
  set<int, cmp> s;
  set<int, cmp>::iterator it1, it2, it3;
  for (int i = 0; i < (int)e.size(); i++) {
    int id = e[i].id;
    nowt = e[i].tme;
    if (ans <= nowt) return ans;
    if (e[i].typ == 0) {
      it1 = it2 = s.insert(id).first;
      if (it1 != s.begin()) ans = min(ans, cal(vp[*(--it1)], vp[id]));
      if (ans <= nowt) return ans;
      it2++;
      if (it2 != s.end()) ans = min(ans, cal(vp[*it2], vp[id]));
      if (ans <= nowt) return ans;
    } else {
      it1 = it2 = it3 = s.find(id);
      it2++;
      if (it3 == s.end()) {
        printf("qwqwqwq");
        exit(619);
      }
      if (it1 != s.begin() && it2 != s.end())
        ans = min(ans, cal(vp[*(--it1)], vp[*it2]));
      if (ans <= nowt) return ans;
      s.erase(it3);
    }
  }
  return ans;
}
void init(int t, int c, int u, int v) {
  if (u == v) {
    qry[top[u]].push_back(node(dep[u], c, t, t));
    return;
  }
  int lca = getlca(u, v);
  int len = dep[u] + dep[v] - 2 * dep[lca];
  double curt = t, tme;
  while (top[u] != top[lca]) {
    tme = (double)(dep[u] - dep[top[u]] + 1) / c;
    qry[top[u]].push_back(node(dep[u], -c, curt, curt + tme));
    curt += tme;
    u = f[top[u]][0];
  }
  tme = (double)(dep[u] - dep[lca]) / c;
  int w = 0;
  if (tme > 0) w = 1, qry[top[u]].push_back(node(dep[u], -c, curt, curt + tme));
  curt = t + (double)len / c;
  while (top[v] != top[lca]) {
    tme = (double)(dep[v] - dep[top[v]] + 1) / c;
    qry[top[v]].push_back(node(dep[top[v]] - 1, c, curt - tme, curt));
    curt -= tme;
    v = f[top[v]][0];
  }
  tme = (double)(dep[v] - dep[lca]) / c;
  if (tme > 0)
    w = 1, qry[top[v]].push_back(node(dep[lca], c, curt - tme, curt));
  if (!w) qry[top[lca]].push_back(node(dep[lca], c, curt - tme, curt - tme));
}
double lfabs(double x) { return x < 0 ? -x : x; }
void getans() {
  double ans = 1e300;
  for (int i = 1; i <= n; i++)
    if (qry[i].size()) {
      ans = min(ans, solve(qry[i]));
    }
  if (ans > 1e299) {
    printf("-1");
  } else
    printf("%.10lf", (double)ans);
}
void dbg() {
  for (int i = 1; i <= n; i++)
    printf("i:%d dep:%d son:%d top:%d\n", i, dep[i], son[i], top[i]);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1, a, b; i <= n - 1; i++)
    scanf("%d%d", &a, &b), ins(a, b), ins(b, a);
  dfs1(1, 0);
  dfs2(1, 1);
  for (int i = 1, a, b, c, d; i <= m; i++) {
    scanf("%d%d%d%d", &a, &b, &c, &d);
    init(a, b, c, d);
  }
  getans();
  return 0;
}