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 eps = 1e-9;
const int N = 100005;
int read() {
  int f = 1, g = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) g = g * 10 + ch - '0';
  return f * g;
}
int n, m, siz, fir[N];
double ans;
struct edge {
  int u, v, nex;
} e[N * 2];
void add(int u, int v) {
  e[++siz] = (edge){u, v, fir[u]};
  fir[u] = siz;
}
int size[N], depth[N], hs[N], fa[N][20], bel[N];
int ccnt, chtop[N];
void build(int x, int fath) {
  fa[x][0] = fath;
  size[x] = 1;
  depth[x] = depth[fath] + 1;
  hs[x] = 0;
  for (int i = 1; i < 20; i++) fa[x][i] = fa[fa[x][i - 1]][i - 1];
  for (int i = fir[x]; i; i = e[i].nex)
    if (e[i].v != fath) {
      build(e[i].v, x);
      size[x] += size[e[i].v];
      if (size[e[i].v] > size[hs[x]]) hs[x] = e[i].v;
    }
}
void build2(int x, int fath) {
  bel[x] = ccnt;
  if (hs[x])
    build2(hs[x], x);
  else
    return;
  for (int i = fir[x]; i; i = e[i].nex)
    if ((e[i].v != fath) && (e[i].v != hs[x])) {
      chtop[++ccnt] = e[i].v;
      build2(e[i].v, x);
    }
}
int lca(int x, int y) {
  if (depth[x] > depth[y]) swap(x, y);
  for (int i = 19; i >= 0; i--)
    if (depth[fa[y][i]] >= depth[x]) y = fa[y][i];
  if (x == y) return x;
  for (int i = 19; i >= 0; i--)
    if (fa[y][i] != fa[x][i]) {
      x = fa[x][i];
      y = fa[y][i];
    }
  return fa[x][0];
}
double T;
struct node {
  int l, r, t, st, v;
};
vector<node> a;
double posi(node a) { return a.v * (T - a.t) + a.st; }
double appear_time(node a) {
  double t1 = 1.0 * (a.l - a.st) / a.v, t2 = 1.0 * (a.r - a.st) / a.v;
  return min(t1, t2) + a.t;
}
double vanish_time(node a) {
  double t1 = 1.0 * (a.l - a.st) / a.v, t2 = 1.0 * (a.r - a.st) / a.v;
  return max(t1, t2) + a.t;
}
double meet_time(node a, node b) {
  int k1 = a.v, k2 = b.v;
  long long b1 = a.st - (long long)a.t * a.v, b2 = b.st - (long long)b.t * b.v;
  double t, p1, p2;
  if (k1 == k2) {
    if (b1 == b2)
      t = max(appear_time(a), appear_time(b));
    else
      return 1e18;
  } else
    t = 1.0 * (b2 - b1) / (k1 - k2);
  p1 = t * k1 + b1, p2 = t * k2 + b2;
  if ((p1 + eps < a.l) || (p1 - eps > a.r) || (p2 + eps < b.l) ||
      (p2 - eps > b.r))
    return 1e18;
  return t;
}
struct heap_node {
  double tim;
  int x, typ;
};
bool operator<(heap_node a, heap_node b) { return a.tim > b.tim; }
struct set_node {
  int x;
};
bool operator<(set_node x, set_node y) {
  double t = posi(a[x.x]) - posi(a[y.x]);
  return (abs(t) >= eps) ? (t < 0) : (x.x < y.x);
}
struct seq {
  priority_queue<heap_node> f;
  set<set_node> h;
  double fans;
  void push(node x) {
    a.push_back(x);
    int i = a.size() - 1;
    double t1 = appear_time(x), t2 = vanish_time(x);
    f.push((heap_node){t1, i, 0});
    f.push((heap_node){t2 + eps, i, 2});
  }
  double solve() {
    T = 0;
    fans = 1e18;
    while (!f.empty()) {
      heap_node cur = f.top();
      f.pop();
      node aa = a[cur.x];
      if (cur.tim > fans) break;
      if (cur.typ == 0) {
        T = cur.tim;
        set_node t;
        t.x = cur.x;
        set<set_node>::iterator it = h.lower_bound(t);
        if (it != h.end()) {
          fans = min(fans, meet_time(a[t.x], a[(*it).x]) - eps);
        }
        if (it != h.begin()) {
          it--;
          fans = min(fans, meet_time(a[t.x], a[(*it).x]) - eps);
        }
        h.insert(t);
      } else {
        T = cur.tim;
        set_node t;
        t.x = cur.x;
        h.erase(t);
        set<set_node>::iterator it = h.lower_bound(t), itl;
        if ((it != h.begin()) && (it != h.end())) {
          itl = it;
          itl--;
          fans = min(fans, meet_time(a[(*itl).x], a[(*it).x]) - eps);
        }
      }
    }
    return fans;
  }
} f[N];
int fl;
void work(int u, int v, int t, int s, int c) {
  while (bel[u] != bel[v]) {
    int z = fa[chtop[bel[u]]][0];
    f[bel[u]].push((node){depth[z], depth[u], t, s, c});
    u = z;
  }
  if (u != v) {
    fl = 1;
    f[bel[u]].push((node){depth[v], depth[u], t, s, c});
  }
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i < n; i++) {
    int u = read(), v = read();
    add(u, v);
    add(v, u);
  }
  build(1, 0);
  chtop[++ccnt] = 1;
  build2(1, 0);
  while (m--) {
    int t = read(), c = read(), u = read(), v = read(), z = lca(u, v);
    fl = 0;
    work(u, z, t, depth[u], -c);
    work(v, z, t, depth[z] - (depth[u] - depth[z]), c);
    if (!fl) {
      f[bel[z]].push((node){depth[z], depth[z], t, depth[u], -c});
    }
  }
  ans = 1e18;
  for (int i = 1; i <= ccnt; i++) {
    ans = min(ans, f[i].solve());
  }
  if (ans > 1e10)
    puts("-1");
  else
    printf("%.9lf\n", ans);
  return 0;
}