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;
int read() {
  int x = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    ;
  for (; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + (ch ^ 48);
  return x;
}
const double eps = 1e-9;
int n, m;
struct Edge {
  int to, nxt;
} edge[200010];
int cnt = 1, last[100010];
inline void addedge(int x, int y) {
  edge[++cnt] = (Edge){y, last[x]}, last[x] = cnt;
  edge[++cnt] = (Edge){x, last[y]}, last[y] = cnt;
}
int fat[100010], dep[100010], son[100010], siz[100010];
int top[100010], id[100010], od[100010];
void dfs1(int cur, int fat, int dep) {
  ::fat[cur] = fat;
  ::dep[cur] = dep;
  siz[cur] = 1;
  for (int i = last[cur], v; i; i = edge[i].nxt)
    if ((v = edge[i].to) ^ fat) {
      dfs1(v, cur, dep + 1);
      siz[cur] += siz[v];
      if (!son[cur] || siz[v] > siz[son[cur]]) son[cur] = v;
    }
}
void dfs2(int cur, int top) {
  ::top[cur] = top;
  od[id[cur] = ++*id] = cur;
  if (siz[cur] == 1) return;
  dfs2(son[cur], top);
  for (int i = last[cur], v; i; i = edge[i].nxt)
    if (v = edge[i].to, (v ^ fat[cur]) && (v ^ son[cur])) dfs2(v, v);
}
struct Node {
  double st, et;
  int sp, ep;
  bool x, y;
} node[2500000];
int nodetot;
struct Rec {
  double tim1;
  bool tim2, opt;
  int val;
} rec[5000000];
int rectop;
bool operator<(const Rec x, const Rec y) {
  if (fabs(x.tim1 - y.tim1) > eps) return x.tim1 < y.tim1;
  if (x.tim2 ^ y.tim2) return x.tim2 < y.tim2;
  return x.opt > y.opt;
}
void work(double t, double c, int u, int v) {
  static pair<int, int> A[100], B[100];
  int Atot = 0, Btot = 0;
  while (top[u] ^ top[v]) {
    if (dep[top[u]] < dep[top[v]])
      B[++Btot] = (pair<int, int>){id[top[v]] - 1, id[v]}, v = fat[top[v]];
    else
      A[++Atot] = (pair<int, int>){id[top[u]] - 1, id[u]}, u = fat[top[u]];
  }
  if (dep[u] < dep[v])
    B[++Btot] = (pair<int, int>){id[u], id[v]};
  else if (dep[u] > dep[v])
    A[++Atot] = (pair<int, int>){id[v], id[u]};
  int s = (dep[u] < dep[v] ? id[u] : id[v]);
  for (int i = 1; i <= Atot; i++) {
    double tt = t + (A[i].second - A[i].first) / c;
    node[++nodetot] = (Node){t, tt, A[i].second, A[i].first, 0, 1};
    rec[++rectop] = (Rec){t, 0, 0, nodetot};
    rec[++rectop] = (Rec){tt, 0, 1, nodetot};
    t = tt;
  }
  node[++nodetot] = (Node){t, t, s, s, 0, 0};
  rec[++rectop] = (Rec){t, 0, 0, nodetot};
  rec[++rectop] = (Rec){t, 1, 1, nodetot};
  for (int i = Btot; i; i--) {
    double tt = t + (B[i].second - B[i].first) / c;
    node[++nodetot] = (Node){t, tt, B[i].first, B[i].second, 1, 0};
    rec[++rectop] = (Rec){t, 1, 0, nodetot};
    rec[++rectop] = (Rec){tt, 1, 1, nodetot};
    t = tt;
  }
}
namespace T {
double tim;
bool cmp(int x, int y) {
  double s = (node[x].ep ^ node[x].sp
                  ? (node[x].ep - node[x].sp) / (node[x].et - node[x].st)
                  : 0),
         t = (node[y].ep ^ node[y].sp
                  ? (node[y].ep - node[y].sp) / (node[y].et - node[y].st)
                  : 0);
  double a = node[x].sp + s * (tim - node[x].st),
         b = node[y].sp + t * (tim - node[y].st);
  if (fabs(a - b) > eps) return a < b;
  if (fabs(s - t) > eps) return s < t;
  return x < y;
}
unsigned rnd() {
  static unsigned sd = 1756984316U;
  return sd ^= sd << 23, sd ^= sd >> 5, sd ^= sd << 11, sd ^= sd >> 26;
}
struct Node {
  int lson, rson, siz;
} node[2500000];
int rt;
inline void pushup(int cur) {
  node[cur].siz = node[(node[cur].lson)].siz + 1 + node[(node[cur].rson)].siz;
}
void split(int cur, int siz, int &x, int &y) {
  if (!cur) return x = y = 0, void();
  if (siz <= node[(node[cur].lson)].siz)
    y = cur, split((node[cur].lson), siz, x, node[y].lson), pushup(y);
  else
    x = cur,
    split((node[cur].rson), siz - node[cur].siz + node[(node[cur].rson)].siz,
          node[x].rson, y),
    pushup(x);
}
int getrk(int cur, int id) {
  if (!cur) return 0;
  if (cmp(id, cur)) return getrk((node[cur].lson), id);
  return node[cur].siz - node[(node[cur].rson)].siz +
         getrk((node[cur].rson), id);
}
int merge(int x, int y) {
  if (!x || !y) return x | y;
  if (rnd() % (node[x].siz + node[y].siz) < node[x].siz)
    return node[x].rson = merge(node[x].rson, y), pushup(x), x;
  return node[y].lson = merge(x, node[y].lson), pushup(y), y;
}
}  // namespace T
void checkans(double &ans, int x, int y) {
  double myk1, myk2, myb1, myb2;
  if (node[x].sp ^ node[x].ep)
    myk1 = (node[x].sp - node[x].ep) / (node[x].st - node[x].et),
    myb1 = node[x].sp - myk1 * node[x].st;
  else
    myk1 = 0, myb1 = node[x].sp;
  if (node[y].sp ^ node[y].ep)
    myk2 = (node[y].sp - node[y].ep) / (node[y].st - node[y].et),
    myb2 = node[y].sp - myk2 * node[y].st;
  else
    myk2 = 0, myb2 = node[y].sp;
  double a;
  bool b;
  if (fabs(node[x].st - node[y].st) > eps)
    if (node[x].st < node[y].st)
      a = node[y].st, b = node[y].x;
    else
      a = node[x].st, b = node[x].x;
  else
    a = node[x].st, b = node[x].x | node[y].x;
  double c;
  bool d;
  if (fabs(node[x].et - node[y].et) > eps)
    if (node[x].et < node[y].et)
      c = node[x].et, d = node[x].y;
    else
      c = node[y].et, d = node[y].y;
  else
    c = node[x].et, d = node[x].y | node[y].y;
  if (fabs(myk1 - myk2) < eps) {
    if (fabs(myb1 - myb2) < eps)
      if (a + eps < c || fabs(a - c) < eps && !b && !d) ans = min(ans, a);
    return;
  }
  double e = (myb2 - myb1) / (myk1 - myk2);
  if ((b ? a + eps < e : a < e + eps) && (d ? e + eps < c : e < c + eps))
    ans = min(ans, e);
}
int main() {
  n = read(), m = read();
  for (int i = 1; i < n; i++) addedge(read(), read());
  dfs1(1, 0, 1);
  dfs2(1, 1);
  for (int i = 1, t, c, u, v; i <= m; i++) {
    t = read(), c = read(), u = read(), v = read();
    work(t, c, u, v);
  }
  double ans = 1e18;
  sort(rec + 1, rec + rectop + 1);
  for (int i = 1, t, x, y, z, a, b, c; i <= rectop; i++) {
    if (ans < rec[i].tim1 + eps) break;
    if (rec[i].opt) {
      T::split(T::rt, t = T::getrk(T::rt, rec[i].val), y, z);
      T::split(y, t - 1, x, y);
      T::rt = T::merge(x, z);
      if (t > 1 && t <= T::node[T::rt].siz) {
        T::split(T::rt, t - 2, y, z);
        T::split(z, 1, a, z);
        T::split(z, 1, b, z);
        checkans(ans, a, b);
        T::rt = T::merge(y, T::merge(a, T::merge(b, z)));
      }
      continue;
    }
    T::tim = rec[i].tim1;
    T::split(T::rt, t = T::getrk(T::rt, rec[i].val), x, z);
    if (x)
      T::split(x, T::node[x].siz - 1, x, a), checkans(ans, a, rec[i].val),
          x = T::merge(x, a);
    if (z)
      T::split(z, 1, b, z), checkans(ans, rec[i].val, b), z = T::merge(b, z);
    if (ans < rec[i].tim1 + eps) break;
    T::node[t = rec[i].val] = (T::Node){0, 0, 1};
    T::rt = T::merge(x, T::merge(t, z));
  }
  if (ans == 1e18)
    puts("-1");
  else
    printf("%.10lf\n", fabs(ans) < eps ? 0.0 : ans);
  return 0;
}