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>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const int oo = 0x3f3f3f3f;
const double eps = 1e-9;
inline int dcmp(const double &first) { return first < -eps ? -1 : first > eps; }
const int maxn = 100100, maxm = 100100;
struct edge {
  int id, nxt;
  edge() {}
  edge(int _id, int _nxt) : id(_id), nxt(_nxt) {}
};
edge e[(maxn << 1) + 5];
int st[maxn + 5], en = 0;
inline void add_edge(int first, int second) {
  e[en] = edge(second, st[first]), st[first] = en++;
}
inline void add_biedge(int first, int second) {
  add_edge(first, second), add_edge(second, first);
}
int n, m;
int fa[maxn + 5];
int sz[maxn + 5], Max[maxn + 5], cur[maxn + 5];
int dfs_seq[maxn + 5], dfs_tot;
int dep[maxn + 5];
void dfs(int first) {
  fa[first] = -1;
  dep[first] = 0;
  int u = first;
  bool flag = 0;
  while (u != -1) {
    if (!flag) {
      dfs_seq[dfs_tot++] = u;
      sz[u] = 1;
      Max[u] = -1;
      cur[u] = st[u];
      flag = 1;
    }
    for (int &i = cur[u]; i != -1; i = e[i].nxt) {
      const int &v = e[i].id;
      if (v == fa[u]) continue;
      dep[v] = dep[u] + 1;
      fa[v] = u;
      u = v;
      i = e[i].nxt;
      flag = 0;
      break;
    }
    if (flag) {
      int v = u;
      u = fa[u];
      if (u != -1) {
        sz[u] += sz[v];
        if (Max[u] == -1 || sz[v] > sz[Max[u]]) Max[u] = v;
      }
    }
  }
}
int top[maxn + 5], start[maxn + 5], chain_sz[maxn + 5];
inline int lca(int first, int second) {
  while (top[first] != top[second]) {
    if (dep[top[first]] > dep[top[second]]) swap(first, second);
    second = fa[top[second]];
  }
  return dep[first] < dep[second] ? first : second;
}
struct seg {
  double x0, x1;
  int __y0, k;
  seg() {}
  seg(const double &_x0, const double &_x1, int _y0, int _k)
      : x0(_x0), x1(_x1), __y0(_y0), k(_k) {}
  inline double val(const double &p) const { return __y0 + (p - x0) * k; }
};
vector<seg> all_seg;
inline bool sect(const seg &first, const seg &second, double &ret) {
  double l = max(first.x0, second.x0), r = min(first.x1, second.x1);
  if (dcmp(l - r) > 0) return 0;
  double u = first.val(l) - second.val(l), v = first.val(r) - second.val(r);
  if (dcmp(u) * dcmp(v) > 0) return 0;
  if (!dcmp(u - v))
    ret = l;
  else
    ret = (-u * r + v * l) / (v - u);
  return 1;
}
inline void query(int first, int second, int t, int c, double per) {
  int d = lca(first, second);
  double curt = t;
  int len = dep[first] + dep[second] - (dep[d] << 1);
  int cnt = 0;
  while (1) {
    double lst = curt;
    int nxt = dep[top[first]] < dep[d] ? d : top[first];
    if (nxt == d) {
      if (dep[first] != dep[nxt]) {
        curt += (dep[first] - dep[nxt]) * per;
        all_seg.push_back(
            seg(lst, curt, start[top[first]] + dep[first] - dep[top[first]] + 1,
                -c));
      } else
        ++cnt;
      break;
    } else {
      curt += (dep[first] - dep[nxt] + 1) * per;
      all_seg.push_back(seg(
          lst, curt, start[top[first]] + dep[first] - dep[top[first]] + 1, -c));
    }
    first = fa[nxt];
  }
  curt = t + len * per;
  while (1) {
    double lst = curt;
    int nxt = dep[top[second]] < dep[d] ? d : top[second];
    if (nxt == d) {
      if (dep[second] != dep[nxt]) {
        curt -= (dep[second] - dep[nxt]) * per;
        all_seg.push_back(
            seg(curt, lst, start[top[second]] + dep[nxt] - dep[top[second]] + 1,
                c));
      } else
        ++cnt;
      break;
    } else {
      curt -= (dep[second] - dep[nxt] + 1) * per;
      all_seg.push_back(
          seg(curt, lst, start[top[second]] + dep[nxt] - dep[top[second]], c));
    }
    second = fa[nxt];
  }
  if (cnt == 2) {
    all_seg.push_back(
        seg(curt, curt, start[top[d]] + dep[d] - dep[top[d]] + 1, c));
    return;
  }
}
double ans = 1e100;
struct event {
  double t;
  int wh;
  event() {}
  event(const double &_t, int _wh) : t(_t), wh(_wh) {}
  friend bool operator<(const event &first, const event &second) {
    int tmp = dcmp(first.t - second.t);
    if (!tmp) return (first.wh & 1) > (second.wh & 1);
    return tmp < 0;
  }
};
vector<event> all_event;
double now;
struct cmp {
  bool operator()(int first, int second) const {
    int tmp = dcmp(all_seg[first].val(now) - all_seg[second].val(now));
    if (!tmp) return first < second;
    return tmp < 0;
  }
};
set<int, cmp> all;
int main() {
  memset(st, -1, sizeof st), en = 0;
  scanf("%d%d", &n, &m);
  for (int i = (0), i_end_ = (n - 1); i < i_end_; ++i) {
    int u, v;
    scanf("%d%d", &u, &v), --u, --v;
    add_biedge(u, v);
  }
  dfs(0);
  top[0] = 0;
  for (int i = (1), i_end_ = (n); i < i_end_; ++i)
    if (sz[dfs_seq[i]] && Max[fa[dfs_seq[i]]] == dfs_seq[i])
      top[dfs_seq[i]] = top[fa[dfs_seq[i]]];
    else
      top[dfs_seq[i]] = dfs_seq[i];
  for (int i = (0), i_end_ = (n); i < i_end_; ++i) ++chain_sz[top[i]];
  int sum = 0;
  for (int i = (0), i_end_ = (n); i < i_end_; ++i)
    if (top[i] == i) start[top[i]] = sum, sum += chain_sz[top[i]] + 1;
  for (int i = (0), i_end_ = (m); i < i_end_; ++i) {
    int t, c, u, v;
    scanf("%d%d%d%d", &t, &c, &u, &v), --u, --v;
    query(u, v, t, c, 1. / c);
  }
  for (int i = (0), i_end_ = ((int((all_seg).size()))); i < i_end_; ++i) {
    all_event.push_back(event(all_seg[i].x0, i << 1 | 1));
    all_event.push_back(event(all_seg[i].x1, i << 1));
  }
  sort((all_event).begin(), (all_event).end());
  double tmp;
  for (auto u : all_event) {
    if (dcmp(u.t - ans) >= 0) break;
    now = u.t;
    int id = u.wh >> 1;
    if (u.wh & 1) {
      all.insert(id);
      auto p = all.find(id);
      auto nxt = p;
      ++nxt;
      if (nxt != all.end()) {
        if (sect(all_seg[*p], all_seg[*nxt], tmp)) chkmin(ans, tmp);
      }
      if (p != all.begin()) {
        auto pre = p;
        --pre;
        if (sect(all_seg[*pre], all_seg[*p], tmp)) chkmin(ans, tmp);
      }
    } else {
      auto p = all.find(id);
      auto nxt = p;
      ++nxt;
      if (p != all.begin()) {
        auto pre = p;
        --pre;
        if (nxt != all.end()) {
          if (sect(all_seg[*pre], all_seg[*nxt], tmp)) chkmin(ans, tmp);
        }
      }
      all.erase(p);
    }
  }
  if (ans > 1e10)
    puts("-1");
  else
    printf("%.15f\n", ans);
  return 0;
}