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 inf = 1e18;
const double eps = 1e-9;
int sign(double a) {
  if (fabs(a) < eps) return 0;
  return a < 0 ? -1 : 1;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
struct Frac {
  long long s, t;
  Frac(long long s = 0, long long t = 1) : s(s), t(t) {
    if (t < 0) {
      s = -s;
      t = -t;
    }
  }
};
Frac operator+(const Frac &a, const Frac &b) {
  long long d = gcd(a.t, b.t);
  return Frac(a.s * (b.t / d) + b.s * (a.t / d), a.t / d * b.t);
}
Frac operator-(const Frac &a, const Frac &b) {
  long long d = gcd(a.t, b.t);
  return Frac(a.s * (b.t / d) - b.s * (a.t / d), a.t / d * b.t);
}
bool operator<(const Frac &a, const Frac &b) { return a.s * b.t < b.s * a.t; }
bool operator>(const Frac &a, const Frac &b) { return b < a; }
bool operator>=(const Frac &a, const Frac &b) { return !(a < b); }
bool operator==(const Frac &a, const Frac &b) {
  return (!(a < b)) && (!(a > b));
}
double value(Frac a) { return double(a.s) / a.t; }
int n, m, p;
int dfc;
int c[100050], d[100050];
int anc[100050];
int dep[100050];
int dfn[100050];
int rnk[100050];
int siz[100050];
int son[100050];
int top[100050];
int head[100050];
double s[100050], t[100050];
Frac H[200050];
vector<int> ad[200050], de[200050];
struct edge {
  int to, nex;
  edge(int to = 0, int nex = 0) : to(to), nex(nex) {}
};
vector<edge> G;
inline void addedge(int u, int v) {
  G.push_back(edge(v, head[u])), head[u] = G.size() - 1;
  G.push_back(edge(u, head[v])), head[v] = G.size() - 1;
}
struct node {
  Frac s, t;
  int d, c;
  node() {}
  node(Frac s, Frac t, int d, int c) : s(s), t(t), d(d), c(c) {}
};
vector<node> rec[100050];
void dfs0(int u) {
  siz[u] = 1;
  for (int i = head[u]; ~i; i = G[i].nex) {
    int v = G[i].to;
    if (v != anc[u]) {
      anc[v] = u;
      dep[v] = dep[u] + 1;
      dfs0(v);
      siz[u] += siz[v];
      if (siz[v] >= siz[son[u]]) son[u] = v;
    }
  }
}
void dfs1(int u, int chain) {
  dfn[u] = ++dfc;
  top[u] = chain;
  rnk[dfc] = u;
  if (son[u]) {
    dfs1(son[u], chain);
  }
  for (int i = head[u]; ~i; i = G[i].nex) {
    int v = G[i].to;
    if (v != anc[u] && v != son[u]) {
      dfs1(v, v);
    }
  }
}
int lca(int u, int v) {
  while (top[u] != top[v]) {
    if (dep[top[u]] > dep[top[v]]) {
      swap(u, v);
    }
    v = anc[top[v]];
  }
  if (dep[u] > dep[v]) {
    swap(u, v);
  }
  return u;
}
int dist(int u, int v) { return dep[u] + dep[v] - (dep[lca(u, v)] << 1); }
void adde(int u, int v, int t, int c) {
  Frac ut(t);
  Frac vt = ut + Frac(dist(u, v), c);
  while (top[u] != top[v]) {
    if (dep[top[u]] > dep[top[v]]) {
      int d = dfn[u] - dfn[top[u]] + 1;
      Frac Ut = ut + Frac(d, c);
      rec[top[u]].push_back(node(ut, Ut, d, -c));
      u = anc[top[u]];
      ut = Ut;
    } else {
      int d = dfn[v] - dfn[top[v]] + 1;
      Frac Vt = vt - Frac(d, c);
      rec[top[v]].push_back(node(Vt, vt, 0, c));
      v = anc[top[v]];
      vt = Vt;
    }
  }
  if (dep[u] > dep[v]) {
    int d = dfn[u] - dfn[top[u]] + 1;
    Frac Ut = ut + Frac(dfn[u] - dfn[v], c);
    rec[top[u]].push_back(node(ut, Ut, d, -c));
  } else {
    int d = dfn[u] - dfn[top[u]] + 1;
    Frac Vt = vt - Frac(dfn[v] - dfn[u], c);
    rec[top[u]].push_back(node(Vt, vt, d, c));
  }
}
double intersection(int p, int q) {
  double k = c[p], b = d[p] - s[p] * c[p];
  double K = c[q], B = d[q] - s[q] * c[q];
  if (sign(k - K) == 0) {
    if (sign(b - B) == 0) {
      return max(s[p], s[q]);
    }
    return inf;
  }
  double x = (B - b) / (k - K);
  if (x + eps > s[p] && x - eps < t[p] && x + eps > s[q] && x - eps < t[q]) {
    return x;
  }
  return inf;
}
double F(int x, double now) { return d[x] + (now - s[x]) * c[x]; }
struct cmp {
  bool operator()(const int &a, const int &b) const {
    double now = max(s[a], s[b]);
    int r = sign(F(a, now) - F(b, now));
    if (r) {
      return r == -1;
    }
    return a < b;
  }
};
set<int, cmp> S;
set<int, cmp>::iterator it;
double solve(const vector<node> &rec) {
  assert((int)rec.size() <= m);
  p = 0;
  for (unsigned int i = 0; i < rec.size(); ++i) {
    H[++p] = rec[i].s;
    H[++p] = rec[i].t;
    s[i] = value(rec[i].s);
    t[i] = value(rec[i].t);
    d[i] = rec[i].d;
    c[i] = rec[i].c;
  }
  sort(H + 1, H + p + 1);
  p = unique(H + 1, H + p + 1) - H - 1;
  for (int i = 1; i <= p; ++i) {
    ad[i].clear();
    de[i].clear();
  }
  for (unsigned int i = 0; i < rec.size(); ++i) {
    int s = lower_bound(H + 1, H + p + 1, rec[i].s) - H;
    int t = lower_bound(H + 1, H + p + 1, rec[i].t) - H;
    ad[s].push_back(i);
    de[t].push_back(i);
  }
  double an = inf;
  S.clear();
  for (int i = 1; i <= p; ++i) {
    double now = value(H[i]);
    if (now + eps > an) {
      break;
    }
    for (unsigned int j = 0; j < ad[i].size(); ++j) {
      int x = ad[i][j];
      it = S.insert(x).first;
      ++it;
      if (it != S.end()) {
        an = min(an, intersection(x, *it));
        if (now + eps > an) {
          return an;
        }
      }
      --it;
      if (it != S.begin()) {
        --it;
        an = min(an, intersection(x, *it));
        if (now + eps > an) {
          return an;
        }
      }
    }
    for (unsigned int j = 0; j < de[i].size(); ++j) {
      int x = de[i][j];
      it = S.find(x);
      ++it;
      if (it != S.end()) {
        int r = *it;
        --it;
        if (it != S.begin()) {
          --it;
          an = min(an, intersection(r, *it));
          ++it;
          if (now + eps > an) {
            return an;
          }
        }
      } else {
        --it;
      }
      S.erase(it);
    }
  }
  return an;
}
int main() {
  scanf("%d%d", &n, &m);
  memset(head, -1, sizeof(head));
  for (int i = 1; i < n; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    addedge(u, v);
  }
  dfs0(1);
  dfs1(1, 1);
  for (int i = 1; i <= m; ++i) {
    int t, c, u, v;
    scanf("%d%d%d%d", &t, &c, &u, &v);
    adde(u, v, t, c);
  }
  double an = inf;
  for (int i = 1; i <= n; ++i)
    if (i == top[i]) {
      an = min(an, solve(rec[i]));
    }
  if (an < inf) {
    printf("%.10lf\n", an);
  } else {
    printf("-1\n");
  }
  return 0;
}