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 <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  int fh = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= fh;
}
struct Info {
  int nu, ne;
} a[100010 * 2];
struct wak {
  int be, en;
  long double bt, v;
} z;
struct Po {
  long double x, y;
};
struct sj {
  int id, ki;
  long double ti;
} cur[100010 * 2];
vector<wak> t[100010], s[100010];
multiset<wak> S;
long double ansn = 1e18, nti;
int m, n, x, y, b[100010], num, f[100010], d[100010], si[100010], so[100010],
    tp[100010], be, v;
long double operator*(Po x, Po y) { return x.x * y.y - x.y * y.x; }
Po operator*(Po x, long double y) { return (Po){x.x * y, x.y * y}; }
Po operator+(Po x, Po y) { return (Po){x.x + y.x, x.y + y.y}; }
Po operator-(Po x, Po y) { return (Po){x.x - y.x, x.y - y.y}; }
bool comp(const sj &a, const sj &b) {
  if (fabs(a.ti - b.ti) < 1e-9) return a.ki > b.ki;
  return a.ti < b.ti;
}
bool operator<(wak x, wak y) {
  long double dx = d[x.be];
  dx += (nti - x.bt) * x.v;
  long double dy = d[y.be];
  dy += (nti - y.bt) * y.v;
  if (fabs(dx - dy) > 1e-9) return dx < dy;
  if (fabs(x.v - y.v) > 1e-9) return x.v > y.v;
  return x.bt < y.bt;
}
void jb(int x, int y) {
  a[++num].nu = y;
  a[num].ne = b[x];
  b[x] = num;
}
void dfs(int x, int fa, int dep) {
  si[x] = 1;
  d[x] = dep;
  f[x] = fa;
  so[x] = 0;
  for (int y = b[x]; y; y = a[y].ne) {
    if (a[y].nu != fa) {
      dfs(a[y].nu, x, dep + 1);
      si[x] += si[a[y].nu];
      if (si[a[y].nu] > si[so[x]]) so[x] = a[y].nu;
    }
  }
}
void dfs1(int x) {
  if (so[x] != 0) {
    tp[so[x]] = tp[x];
    dfs1(so[x]);
  }
  for (int y = b[x]; y; y = a[y].ne) {
    if (a[y].nu != so[x] && a[y].nu != f[x]) {
      tp[a[y].nu] = a[y].nu;
      dfs1(a[y].nu);
    }
  }
}
int lca(int x, int y) {
  while (tp[x] != tp[y]) {
    if (d[tp[x]] < d[tp[y]]) swap(x, y);
    x = f[tp[x]];
  }
  if (d[x] < d[y]) return x;
  return y;
}
void add(int x, int y, long double ti, long double v) {
  int p = lca(x, y);
  long double et = ti + (d[x] + d[y] - d[p] - d[p]) / v;
  while (tp[x] != tp[y]) {
    if (d[tp[x]] < d[tp[y]]) {
      et -= (d[y] - d[tp[y]]) / v;
      z.be = tp[y];
      z.en = y;
      z.bt = et;
      z.v = v;
      t[tp[y]].push_back(z);
      y = tp[y];
      et -= 1 / v;
      z.be = f[y];
      z.en = y;
      z.bt = et;
      z.v = v;
      s[y].push_back(z);
      y = f[y];
    } else {
      ti = ti + (d[x] - d[tp[x]]) / v;
      z.be = tp[x];
      z.en = x;
      z.bt = ti;
      z.v = -v;
      t[tp[x]].push_back(z);
      x = tp[x];
      ti = ti + 1 / v;
      z.be = f[x];
      z.en = x;
      z.bt = ti;
      z.v = -v;
      s[x].push_back(z);
      x = f[x];
    }
  }
  if (d[x] < d[y]) {
    z.be = x;
    z.en = y;
    z.bt = ti;
    z.v = v;
    t[tp[x]].push_back(z);
  } else {
    z.be = y;
    z.en = x;
    z.bt = et;
    z.v = -v;
    t[tp[x]].push_back(z);
  }
}
void add(wak x, wak y) {
  if (x.be == x.en && y.be == y.en) {
    if (x.be == y.be) ansn = min(ansn, x.bt);
    return;
  }
  if (y.be == y.en) swap(x, y);
  Po a1 = (Po){(long double)(d[x.be]), x.bt};
  Po a2 = (Po){(long double)(d[x.en] - d[x.be]), (d[x.en] - d[x.be]) / x.v};
  Po b1 = (Po){(long double)(d[y.be]), y.bt};
  Po b2 = (Po){(long double)(d[y.en] - d[y.be]), (d[y.en] - d[y.be]) / y.v};
  if (fabs(a2 * b2) < 1e-9) {
    if (fabs((b1 - a1) * b2) < 1e-9) {
      if (a1.x > b1.x - 1e-9 && a1.x < b1.x + b2.x + 1e-9)
        ansn = min(ansn, a1.y);
      if ((a1 + a2).x > b1.x - 1e-9 && (a1 + a2).x < b1.x + b1.y + 1e-9)
        ansn = min(ansn, (a1 + a2).y);
      if (b1.x > a1.x - 1e-9 && b1.x < a1.x + a2.x + 1e-9)
        ansn = min(ansn, b1.y);
      if ((b1 + b2).x > a1.x - 1e-9 && (b1 + b2).x < a1.x + a2.x + 1e-9)
        ansn = min(ansn, (b1 + b2).y);
    }
    return;
  }
  Po tmp = b1 - a1;
  long double k = (tmp * b2) / (a2 * b2);
  Po an = a1 + (a2 * k);
  if (an.x > a1.x - 1e-9 && an.x < a1.x + a2.x + 1e-9 && an.x > b1.x - 1e-9 &&
      an.x < b1.x + b2.x + 1e-9)
    ansn = min(ansn, an.y);
}
void solve(vector<wak> t) {
  if (!t.size()) return;
  int nc = 0;
  S.clear();
  for (int i = 0; i < t.size(); i++) {
    if (t[i].v > 1e-9) {
      cur[++nc].id = i;
      cur[nc].ki = 1;
      cur[nc].ti = t[i].bt;
      cur[++nc].id = i;
      cur[nc].ki = 0;
      cur[nc].ti = t[i].bt + (d[t[i].en] - d[t[i].be]) / t[i].v;
    } else {
      cur[++nc].id = i;
      cur[nc].ki = 0;
      cur[nc].ti = t[i].bt;
      cur[++nc].id = i;
      cur[nc].ki = 1;
      cur[nc].ti = t[i].bt + (d[t[i].en] - d[t[i].be]) / t[i].v;
    }
  }
  sort(cur + 1, cur + nc + 1, comp);
  for (int i = 1; i <= nc; i++) {
    if (cur[i].ti > ansn + 1e-9) return;
    nti = cur[i].ti;
    if (cur[i].ki == 1) {
      S.insert(t[cur[i].id]);
      set<wak>::iterator p = S.lower_bound(t[cur[i].id]);
      p++;
      if (p != S.end()) add(t[cur[i].id], *p);
      p--;
      if (p != S.begin()) {
        p--;
        add(t[cur[i].id], *p);
      }
    } else {
      set<wak>::iterator p = S.lower_bound(t[cur[i].id]);
      S.erase(p);
    }
  }
}
int main() {
  read(n);
  read(m);
  for (int i = 1; i < n; i++) {
    read(x);
    read(y);
    jb(x, y);
    jb(y, x);
  }
  dfs(1, 0, 1);
  tp[1] = 1;
  num = 0;
  dfs1(1);
  while (m--) {
    read(be);
    read(v);
    read(x);
    read(y);
    add(x, y, be, v);
  }
  for (int i = 1; i <= n; i++) {
    solve(t[i]);
    solve(s[i]);
  }
  if (fabs(ansn - 1e18) < 1e-9)
    puts("-1");
  else
    printf("%.10Lf", ansn);
  return 0;
}