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 MAX_N = 1e5 + 10;
const double INF = 1e8, EPS = 1e-8;
double dcmp(double x) {
  if (abs(x) < EPS) return 0;
  return x < 0 ? -1 : 1;
}
double dcmp(double x, double y) { return dcmp(x - y); }
double tick, ans = INF;
int _segment_id_alloc;
struct Segment {
  int id;
  double x1, x2, k, b;
  Segment() : id(++_segment_id_alloc) {}
  Segment(double x1, double x2, double k, double b)
      : id(++_segment_id_alloc), x1(x1), x2(x2), k(k), b(b) {}
  bool operator<(const Segment &rhs) const {
    return k * tick + b < rhs.k * tick + rhs.b;
  }
};
void describe(Segment s) {
  double y1 = s.x1 * s.k + s.b, y2 = s.x2 * s.k + s.b;
  printf("(%.2lf, %.2lf) <--> (%.2lf, %.2lf)\n", s.x1, y1, s.x2, y2);
}
struct Treap *root;
struct Treap {
  Treap *cl, *cr, *pa;
  int prio;
  Segment *seg;
  Treap(Segment &seg) : cl(NULL), cr(NULL), pa(NULL), prio(rand()), seg(&seg) {}
  void set_cl(Treap *x) {
    if (cl = x) x->pa = this;
  }
  void set_cr(Treap *x) {
    if (cr = x) x->pa = this;
  }
  void rotate_l() {
    Treap *x = cr;
    if (pa) {
      if (pa->cl == this)
        pa->set_cl(x);
      else
        pa->set_cr(x);
    } else
      x->pa = nullptr;
    set_cr(x->cl);
    x->set_cl(this);
    if (root == this) root = x;
  }
  void rotate_r() {
    Treap *x = cl;
    if (pa) {
      if (pa->cl == this)
        pa->set_cl(x);
      else
        pa->set_cr(x);
    } else
      x->pa = nullptr;
    set_cl(x->cr);
    x->set_cr(this);
    if (root == this) root = x;
  }
  Treap *next() {
    Treap *x = this;
    if (x->cr) {
      x = x->cr;
      while (x->cl) x = x->cl;
      return x;
    } else {
      while (x->pa && x == x->pa->cr) x = x->pa;
      return x->pa;
    }
  }
  Treap *prev() {
    Treap *x = this;
    if (x->cl) {
      x = x->cl;
      while (x->cr) x = x->cr;
      return x;
    } else {
      while (x->pa && x == x->pa->cl) x = x->pa;
      return x->pa;
    }
  }
};
Treap *insert(Segment &seg, Treap *&_x = root, Treap *y = nullptr) {
  if (!_x) {
    Treap *x = _x = new Treap(seg);
    x->pa = y;
    while (x->pa && x->prio < x->pa->prio) {
      if (x->pa->cl == x)
        x->pa->rotate_r();
      else
        x->pa->rotate_l();
    }
    return x;
  } else {
    if (seg < *(_x->seg)) {
      return insert(seg, _x->cl, _x);
    } else {
      return insert(seg, _x->cr, _x);
    }
  }
}
void erase(Treap *x) {
  while (x->cl || x->cr) {
    if (!x->cl)
      x->rotate_l();
    else if (!x->cr)
      x->rotate_r();
    else if (x->cl->prio < x->cr->prio)
      x->rotate_r();
    else
      x->rotate_l();
  }
  if (x->pa) {
    if (x->pa->cl == x)
      x->pa->cl = nullptr;
    else
      x->pa->cr = nullptr;
  } else
    root = nullptr;
  delete x;
}
void erase_all(Treap *&x) {
  if (!x) return;
  erase_all(x->cl);
  erase_all(x->cr);
  delete x;
  x = nullptr;
}
int N, M, pa[MAX_N], depth[MAX_N], top[MAX_N], weight[MAX_N], prefer[MAX_N];
set<int> assign[MAX_N];
vector<int> edge[MAX_N], child[MAX_N];
vector<Segment> pass[MAX_N];
int LCA(int a, int b) {
  while (top[a] != top[b]) {
    if (depth[top[a]] < depth[top[b]])
      b = pa[top[b]];
    else
      a = pa[top[a]];
  }
  return depth[a] < depth[b] ? a : b;
}
namespace init {
void dfs1(int x, int y, int z) {
  depth[x] = y;
  pa[x] = z;
  weight[x] = 1;
  for (int i : edge[x]) {
    if (i == pa[x]) continue;
    child[x].push_back(i);
    dfs1(i, y + 1, x);
    weight[x] += weight[i];
  }
  sort(child[x].begin(), child[x].end(),
       [](int a, int b) { return weight[a] > weight[b]; });
  if (!child[x].empty()) prefer[x] = child[x].front();
}
void dfs2(int x, int y) {
  top[x] = y;
  for (int i : child[x]) dfs2(i, i == prefer[x] ? y : i);
}
void main() {
  scanf("%d%d", &N, &M);
  for (int i = 1; i < N; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  dfs1(1, 1, 0);
  dfs2(1, 1);
  for (int i = 1; i <= M; i++) {
    int u, v;
    double t, c;
    scanf("%lf%lf%d%d", &t, &c, &u, &v);
    int w = LCA(u, v);
    double et = t + (depth[u] + depth[v] - 2 * depth[w]) / c;
    while (top[u] != top[v]) {
      if (depth[top[u]] > depth[top[v]]) {
        double nt = t + (depth[u] - depth[top[u]] + 1) / c;
        double k = -c, b = depth[u] - t * k;
        pass[top[u]].emplace_back(t, nt, k, b);
        assign[top[u]].insert(i);
        u = pa[top[u]];
        t = nt;
      } else {
        double nt = et - (depth[v] - depth[top[v]] + 1) / c;
        double k = c, b = depth[v] - et * k;
        pass[top[v]].emplace_back(nt, et, k, b);
        assign[top[v]].insert(i);
        v = pa[top[v]];
        et = nt;
      }
    }
    if (depth[u] > depth[v]) {
      double k = -c, b = depth[u] - t * k;
      pass[top[u]].emplace_back(t, et, k, b);
      assign[top[u]].insert(i);
      u = v;
      t = et;
    } else {
      double k = c, b = depth[v] - et * k;
      pass[top[v]].emplace_back(t, et, k, b);
      assign[top[v]].insert(i);
      v = u;
      et = t;
    }
    if (!assign[top[u]].count(i)) {
      pass[top[u]].emplace_back(t, t, 0, depth[u]);
    }
  }
}
}  // namespace init
struct Event {
  Segment *s;
  double x;
  int d;
  Event() {}
  Event(Segment *s, double x, int d) : s(s), x(x), d(d) {}
  bool operator<(const Event &rhs) const { return x < rhs.x; }
};
void update_ans(const Segment &s1, const Segment &s2) {
  double l = max(s1.x1, s2.x1), r = min(s1.x2, s2.x2);
  if (dcmp(l, r) > 0) return;
  if (dcmp(s1.k, s2.k) == 0) {
    if (dcmp(s1.b, s2.b) == 0) ans = min(ans, l);
  } else {
    double x = -(s1.b - s2.b) / (s1.k - s2.k);
    if (dcmp(x, l) < 0 || dcmp(x, r) > 0) return;
    ans = min(ans, x);
  }
}
void solve(int cid) {
  map<int, Treap *> mp;
  vector<Event> events;
  for (Segment &s : pass[cid]) {
    s.x1 -= EPS;
    s.x2 += EPS;
    events.emplace_back(&s, s.x1, 1);
    events.emplace_back(&s, s.x2, -1);
  }
  sort(events.begin(), events.end());
  for (Event event : events) {
    tick = event.x;
    if (tick > ans) {
      erase_all(root);
      return;
    }
    if (event.d == 1) {
      Treap *x = mp[event.s->id] = insert(*event.s);
      Treap *xp = x->prev(), *xn = x->next();
      if (xp) update_ans(*(x->seg), *(xp->seg));
      if (xn) update_ans(*(x->seg), *(xn->seg));
    } else {
      Treap *x = mp[event.s->id];
      erase(x);
    }
  }
}
void solve() {
  for (int i = 1; i <= N; i++) {
    if (top[i] == i) {
      solve(i);
    }
  }
  if (ans == INF) ans = -1;
  printf("%.10lf\n", ans);
}
int main() {
  init::main();
  solve();
}