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 int N = 100000, C = 20;
const long long INF = 2e4;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
struct frac {
  long long x, y;
  frac(long long X = 0, long long Y = 1) {
    x = X;
    y = Y;
  }
  frac Norm() {
    long long g = gcd(abs(x), abs(y));
    if (y < 0) g = -g;
    return frac(x / g, y / g);
  }
  frac operator+(const frac &p) const {
    return frac(x * p.y + y * p.x, y * p.y).Norm();
  }
  frac operator-(const frac &p) const {
    return frac(x * p.y - y * p.x, y * p.y).Norm();
  }
  frac operator-() const { return frac(-x, y); }
  frac operator*(const frac &p) const { return frac(x * p.x, y * p.y).Norm(); }
  frac operator/(const frac &p) const { return frac(x * p.y, y * p.x).Norm(); }
  bool operator<(const frac &p) const { return x * p.y < y * p.x; }
  bool operator>(const frac &p) const { return x * p.y > y * p.x; }
  bool operator<=(const frac &p) const { return x * p.y <= y * p.x; }
  bool operator>=(const frac &p) const { return x * p.y >= y * p.x; }
  bool operator==(const frac &p) const { return x * p.y == y * p.x; }
};
struct side {
  int y, next;
} e[N * 2 + 9];
int lin[N + 9], cs;
void Ins(int x, int y) {
  e[++cs].y = y;
  e[cs].next = lin[x];
  lin[x] = cs;
}
void Ins2(int x, int y) {
  Ins(x, y);
  Ins(y, x);
}
struct node {
  int fa, son, dep, siz, top, dfs;
} d[N + 9];
int co;
void Dfs_ord0(int k, int fa) {
  d[k].fa = fa;
  d[k].dep = d[fa].dep + 1;
  d[k].siz = 1;
  for (int i = lin[k]; i; i = e[i].next)
    if (e[i].y ^ fa) {
      Dfs_ord0(e[i].y, k);
      d[k].siz += d[e[i].y].siz;
      if (d[e[i].y].siz > d[d[k].son].siz) d[k].son = e[i].y;
    }
}
void Dfs_ord1(int k, int top) {
  d[k].top = top;
  d[k].dfs = ++co;
  if (d[k].son) Dfs_ord1(d[k].son, top);
  for (int i = lin[k]; i; i = e[i].next)
    if (e[i].y ^ d[k].fa && e[i].y ^ d[k].son) Dfs_ord1(e[i].y, e[i].y);
}
int Query_lca(int x, int y) {
  for (; d[x].top ^ d[y].top; x = d[d[x].top].fa)
    if (d[d[x].top].dep < d[d[y].top].dep) swap(x, y);
  return d[x].dep < d[y].dep ? x : y;
}
frac Query_dis(int x, int y) {
  return frac((long long)d[x].dep + d[y].dep - 2 * d[Query_lca(x, y)].dep);
}
struct line {
  frac k, b, l, r;
  line(frac K = frac(), frac B = frac(), frac L = frac(), frac R = frac()) {
    k = K;
    b = B;
    l = L;
    r = R;
  }
};
frac tim, goa;
vector<line> hv[N + 9], lt[N + 9];
void Add_q(int x, int y, frac s, frac v) {
  frac t = s + Query_dis(x, y) / v, len;
  for (; d[x].top ^ d[y].top;)
    if (d[d[x].top].dep > d[d[y].top].dep) {
      int fx = d[x].top;
      len = frac((long long)d[x].dep - d[fx].dep) / v;
      hv[fx].push_back(line(-v, frac(d[x].dep) + v * s, s, s + len));
      s = s + len;
      x = fx;
      fx = d[x].fa;
      len = frac((long long)d[x].dep - d[fx].dep) / v;
      lt[x].push_back(line(-v, frac(d[x].dep) + v * s, s, s + len));
      s = s + len;
      x = fx;
    } else {
      int fy = d[y].top;
      len = frac((long long)d[y].dep - d[fy].dep) / v;
      hv[fy].push_back(line(v, frac(d[y].dep) - v * t, t - len, t));
      t = t - len;
      y = fy;
      fy = d[y].fa;
      len = frac((long long)d[y].dep - d[fy].dep) / v;
      lt[y].push_back(line(v, frac(d[y].dep) - v * t, t - len, t));
      t = t - len;
      y = fy;
    }
  int fx = d[x].top;
  if (d[x].dep > d[y].dep)
    hv[fx].push_back(line(-v, frac(d[x].dep) + v * s, s, t));
  else
    hv[fx].push_back(line(v, frac(d[y].dep) - v * t, s, t));
}
bool operator<(line a, line b) {
  if (a.k * tim + a.b == b.k * tim + b.b)
    return a.l == b.l ? a.r == b.r ? a.k < b.k : a.r < b.r : a.l < b.l;
  else
    return a.k * tim + a.b < b.k * tim + b.b;
}
multiset<line> s;
bool cmp(pair<line, bool> x, pair<line, bool> y) {
  frac tx = x.second ? x.first.l : x.first.r;
  frac ty = y.second ? y.first.l : y.first.r;
  if (tx == ty)
    return x.second > y.second;
  else
    return tx < ty;
}
frac Get_cross(line a, line b) {
  if (a.k == b.k) return a.b == b.b ? max(a.l, b.l) : frac(INF);
  frac res = (b.b - a.b) / (a.k - b.k);
  return res >= max(a.l, b.l) && res <= min(a.r, b.r) ? res : frac(INF);
}
double ans;
void Get_ans(vector<line> &a) {
  s.clear();
  goa = frac(INF);
  vector<pair<line, bool> > b;
  for (vector<line>::iterator it = a.begin(); it != a.end(); ++it)
    b.emplace_back(*it, 1), b.emplace_back(*it, 0);
  sort(b.begin(), b.end(), cmp);
  for (vector<pair<line, bool> >::iterator it = b.begin(); it != b.end();
       ++it) {
    pair<line, bool> x = *it;
    frac now = x.second ? x.first.l : x.first.r;
    if (now >= goa) {
      ans = min(ans, 1.0 * goa.x / goa.y);
      return;
    }
    tim = now;
    if (x.second) {
      multiset<line>::iterator tmp = s.insert(x.first), pre = tmp, suf = tmp;
      if (pre != s.begin()) goa = min(goa, Get_cross(*--pre, *tmp));
      if (suf != --s.end()) goa = min(goa, Get_cross(*++suf, *tmp));
    } else {
      multiset<line>::iterator tmp = s.lower_bound(x.first), pre = tmp,
                               suf = tmp;
      if (suf != --s.end() && pre != s.begin())
        goa = min(goa, Get_cross(*--pre, *++suf));
      s.erase(tmp);
    }
  }
  ans = min(ans, 1.0 * goa.x / goa.y);
}
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i < n; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    Ins2(x, y);
  }
  Dfs_ord0(1, 0);
  Dfs_ord1(1, 1);
  for (int i = 1; i <= m; ++i) {
    int x, y;
    frac t, v;
    scanf("%d%d", &x, &y);
    t = frac(x);
    v = frac(y);
    scanf("%d%d", &x, &y);
    Add_q(x, y, t, v);
  }
  ans = 1.0 * INF;
  for (int i = 1; i <= n; ++i) Get_ans(hv[i]), Get_ans(lt[i]);
  ans >= 1.0 * INF ? puts("-1") : printf("%.10lf", ans);
  return 0;
}