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_MAX = 1e5 + 10;
const double INF = 1e18;
const double EPS = 1e-8;
vector<int> gra[N_MAX];
int par[20][N_MAX], dep[N_MAX], sz[N_MAX];
struct data {
  int origin, pos;
  double t1, t2, c;
};
int lca(int a, int b) {
  if (dep[a] < dep[b]) swap(a, b);
  for (int i = 19; i >= 0; i--) {
    int tmp = par[i][a];
    a = (dep[tmp] >= dep[b]) ? tmp : a;
  }
  if (a == b) return a;
  for (int i = 19; i >= 0; i--) {
    int ta = par[i][a], tb = par[i][b];
    if (ta != tb) a = ta, b = tb;
  }
  return par[0][a];
}
void dfs1(const int &u, const int &pre) {
  sz[u] = 1;
  par[0][u] = pre;
  dep[u] = dep[pre] + 1;
  for (int v : gra[u]) {
    if (v == pre) continue;
    dfs1(v, u);
    sz[u] += sz[v];
  }
  return;
}
int belong[N_MAX], pos[N_MAX];
void dfs2(const int &u, const int &pre, const int &chain) {
  belong[u] = chain;
  pos[u] = (belong[u] == belong[pre]) ? pos[pre] + 1 : 1;
  int heavy = -1;
  for (int v : gra[u]) {
    if (v == pre) continue;
    if (sz[v] > sz[heavy]) heavy = v;
  }
  if (heavy == -1) return;
  for (int v : gra[u]) {
    if (v == pre) continue;
    if (v == heavy)
      dfs2(v, u, chain);
    else
      dfs2(v, u, v);
  }
  return;
}
vector<data> part[N_MAX];
vector<data> &suits = part[0];
double cur_tm;
class cmp {
 public:
  bool operator()(const int a, const int b) {
    double x = (cur_tm - suits[a].t1) * suits[a].c + suits[a].pos;
    double y = (cur_tm - suits[b].t1) * suits[b].c + suits[b].pos;
    if (fabs(x - y) > EPS) return x < y;
    return a < b;
  }
};
double inter(const int &a, const int &b) {
  data x = suits[a], y = suits[b];
  (void)0;
  if (x.origin == y.origin) return INF;
  double tmp = (y.t2 - y.t1) * y.c + y.pos;
  double m = x.c * x.t1 - x.pos;
  double m1 = x.c * y.t1 - y.pos - m, m2 = m - (x.c * y.t2 - tmp);
  double ret;
  if (m1 * m2 < -EPS) return INF;
  if (fabs(m1) + fabs(m2) < EPS)
    ret = max(x.t1, y.t1);
  else
    ret = (y.t1 * m2 + y.t2 * m1) / (m1 + m2);
  (void)0;
  if (ret > x.t1 - EPS && ret < x.t2 + EPS && ret > y.t1 - EPS &&
      ret < y.t2 + EPS) {
    (void)0;
    return ret;
  } else
    return INF;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    gra[u].push_back(v);
    gra[v].push_back(u);
  }
  dfs1(1, 0);
  for (int i = 1; i < 20; i++) {
    for (int j = 1; j <= n; j++) par[i][j] = par[i - 1][par[i - 1][j]];
  }
  dfs2(1, 0, 1);
  for (int i = 1; i <= n; i++) (void)0;
  (void)0;
  for (int i = 1; i <= n; i++) (void)0;
  (void)0;
  for (int i = 1; i <= n; i++) (void)0;
  (void)0;
  for (int i = 0; i < m; i++) {
    double t, c;
    int st, ed;
    cin >> t >> c >> st >> ed;
    int x = lca(st, ed);
    (void)0;
    int ptr = st;
    double tm = t;
    while (true) {
      bool end = (belong[ptr] == belong[x]);
      double nt =
          tm + (end ? (double)(pos[ptr] - pos[x]) / c : (double)pos[ptr] / c);
      part[belong[ptr]].push_back(data{i, pos[ptr], tm, nt, -c});
      tm = nt;
      if (end)
        break;
      else
        ptr = par[0][belong[ptr]];
    }
    ptr = ed;
    tm += (double)(dep[ed] - dep[x]) / c;
    while (true) {
      bool end = (belong[ptr] == belong[x]);
      double nt =
          tm - (end ? (double)(pos[ptr] - pos[x]) / c : (double)pos[ptr] / c);
      part[belong[ptr]].push_back(data{i, end ? pos[x] : 0, nt, tm, c});
      tm = nt;
      if (end)
        break;
      else
        ptr = par[0][belong[ptr]];
    }
  }
  double ans = INF;
  for (int i = 1; i <= n; i++) {
    (void)0;
    if (belong[i] != i) continue;
    struct event {
      double tm;
      int id;
      bool tp;
      bool operator<(const event &a) const {
        if (fabs(tm - a.tm) > EPS) return tm < a.tm;
        if (tp ^ a.tp) return tp;
        return id < a.id;
      }
    };
    vector<event> vec;
    for (int j = 0; j < ((int)(part[i]).size()); j++) {
      data x = part[i][j];
      (void)0;
      vec.push_back(event{x.t1, j, true});
      vec.push_back(event{x.t2, j, false});
    }
    sort((vec).begin(), (vec).end());
    suits = part[i];
    set<int, cmp> st;
    for (event e : vec) {
      if (e.tm > ans - EPS) break;
      cur_tm = e.tm;
      (void)0;
      if (e.tp) {
        set<int, cmp>::iterator x = (st.insert(e.id)).first;
        if (x != st.begin()) ans = min(ans, inter(*x, *prev(x, 1)));
        if (next(x, 1) != st.end()) ans = min(ans, inter(*x, *next(x, 1)));
      } else {
        set<int, cmp>::iterator x = st.find(e.id);
        if (x != st.begin() && next(x, 1) != st.end())
          ans = min(ans, inter(*prev(x, 1), *next(x, 1)));
        st.erase(e.id);
      }
    }
  }
  if (ans == INF)
    puts("-1");
  else
    cout << fixed << setprecision(10) << ans << endl;
  return 0;
}