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;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int &x, int y, int mod = 1000000007) {
  x += y;
  if (x >= mod) x -= mod;
}
void et() {
  puts("-1");
  exit(0);
}
vector<int> mp[100005];
struct Hld {
  int fa[100005], bigSon[100005], sz[100005], deep[100005];
  int head[100005];
  void calSize(int x, int pa) {
    sz[x] = 1;
    fa[x] = pa;
    deep[x] = deep[pa] + 1;
    int mx = 0;
    for (int c : mp[x])
      if (c != pa) {
        calSize(c, x);
        sz[x] += sz[c];
        if (mx < sz[c]) {
          mx = sz[c];
          bigSon[x] = c;
        }
      }
  }
  void build(int x, int H) {
    head[x] = H;
    if (bigSon[x] != 0) build(bigSon[x], H);
    for (int c : mp[x])
      if (c != fa[x] && c != bigSon[x]) {
        build(c, c);
      }
  }
  int lca(int x, int y) {
    while (head[x] != head[y]) {
      if (deep[head[x]] < deep[head[y]]) {
        swap(x, y);
      }
      x = fa[head[x]];
    }
    return deep[x] < deep[y] ? x : y;
  }
} ynk;
long double tot;
struct node {
  long double t, pt;
  int pos, v, tp;
  long double gg() { return pos + (tot - t) * v; }
  void pp() {
    cout << t << " " << pt << " " << pos << " " << v << " " << tp << endl;
  }
  friend bool operator<(node a, node b) {
    if (fabs(a.gg() - b.gg()) < 1e-9) return a.v < b.v;
    return a.gg() < b.gg();
  }
};
vector<node> P[100005];
multiset<node> S;
long double calc(node x, node y) {
  long double px = x.gg(), py = y.gg();
  if (x.v == y.v) {
    return fabs(px - py) < 1e-9 ? 0 : (1 << 30);
  }
  long double ret = (px - py) / (y.v - x.v);
  if (ret + 1e-9 > 0 && tot + ret < min(x.pt, y.pt) + 1e-9) return ret;
  return (1 << 30);
}
void ins(int id, long double &st, long double period, int relativePos, int v) {
  long double x = st;
  st += period;
  long double y = st;
  if (x > y) {
    x += 1e-9;
    y -= 1e-9;
  } else {
    x -= 1e-9;
    y += 1e-9;
  }
  P[id].push_back({x, y, relativePos, v, x < y});
  P[id].push_back({y, x, relativePos, v, y < x});
}
void addSuit() {
  int t, v, fr, to;
  scanf("%d%d%d%d", &t, &v, &fr, &to);
  int fa = ynk.lca(fr, to);
  long double ed =
      (long double)(ynk.deep[fr] + ynk.deep[to] - ynk.deep[fa] * 2) / v + t;
  long double st = t;
  while (ynk.head[fr] != ynk.head[fa]) {
    ins(ynk.head[fr], st,
        (long double)(ynk.deep[fr] - ynk.deep[ynk.fa[ynk.head[fr]]]) / v,
        ynk.deep[fr], -v);
    fr = ynk.fa[ynk.head[fr]];
  }
  while (ynk.head[fa] != ynk.head[to]) {
    ins(ynk.head[to], ed,
        -(long double)(ynk.deep[to] - ynk.deep[ynk.fa[ynk.head[to]]]) / v,
        ynk.deep[ynk.fa[ynk.head[to]]], v);
    to = ynk.fa[ynk.head[to]];
  }
  ins(ynk.head[fa], st, ed - st, ynk.deep[fr],
      ynk.deep[fr] < ynk.deep[to] ? v : -v);
}
bool cmp(node a, node b) {
  if (fabs(a.t - b.t) < 1e-9) return a.tp > b.tp;
  return a.t + 1e-9 < b.t;
}
bool vis[100005];
void fmain() {
  scanf("%d%d", &n, &m);
  for (int i = 0, u, v; i < n - 1; i++) {
    scanf("%d%d", &u, &v);
    mp[u].push_back(v);
    mp[v].push_back(u);
  };
  ynk.calSize(1, 0);
  ynk.build(1, 1);
  for (int(i) = 1; (i) <= (int)(m); (i)++) addSuit();
  long double ans = (1 << 30);
  for (int(id) = 1; (id) <= (int)(n); (id)++)
    if (!vis[ynk.head[id]]) {
      int x = ynk.head[id];
      vis[x] = 1;
      long double res = (1 << 30);
      S.clear();
      sort(P[x].begin(), P[x].end(), cmp);
      int N = P[x].size();
      for (int(i) = 0; (i) < (int)(N); (i)++) {
        tot = P[x][i].t;
        if (tot > res) break;
        if (P[x][i].tp) {
          auto r = S.lower_bound(P[x][i]);
          if (r != S.end()) res = min(res, calc(P[x][i], *r) + tot);
          if (r != S.begin()) {
            r--;
            res = min(res, calc(P[x][i], *r) + tot);
          }
          S.insert(P[x][i]);
        } else {
          node tmp = P[x][i];
          swap(tmp.t, tmp.pt);
          S.erase(S.find(tmp));
          auto l = S.lower_bound(tmp), r = l;
          if (r != S.end() && l != S.begin()) {
            l--;
            res = min(res, calc(*l, *r) + tot);
          }
        }
      }
      ans = min(ans, res);
    }
  if (fabs(ans - (1 << 30)) < 1e-9)
    puts("-1");
  else
    printf("%.10Lf\n", ans);
}
int main() {
  fmain();
  return 0;
}