Problem: After returning to shore, uncle Bogdan usually visits the computer club "The Rock", to solve tasks in a pleasant company. One day, uncle Bogdan met his good old friend who told him one unusual task...

There are n non-intersecting horizontal segments with ends in integers points on the plane with the standard cartesian coordinate system. All segments are strictly above the OX axis. You can choose an arbitrary vector (a, b), where b < 0 and coordinates are real numbers, and project all segments to OX axis along this vector. The projections shouldn't intersect but may touch each other.

Find the minimum possible difference between x coordinate of the right end of the rightmost projection and x coordinate of the left end of the leftmost projection.

Input

The first line contains the single integer n (1 ≤ n ≤ 2000) — the number of segments.

The i-th of the next n lines contains three integers xl_i, xr_i and y_i (-10^6 ≤ xl_i < xr_i ≤ 10^6; 1 ≤ y_i ≤ 10^6) — coordinates of the corresponding segment.

It's guaranteed that the segments don't intersect or touch.

Output

Print the minimum possible difference you can get.

Your answer will be considered correct if its absolute or relative error doesn't exceed 10^{-6}.

Formally, if your answer is a and jury's answer is b then your answer will be considered correct if \frac{|a - b|}{max{(1, |b|)}} ≤ 10^{-6}.

Examples

Input


3
1 6 2
4 6 4
4 6 6


Output


9.000000000


Input


3
2 5 1
4 6 4
7 8 2


Output


6.333333333


Input


2
1 3 1
4 7 1


Output


6.000000000

Note

In the first example if we project segments along the vector (1, -1) then we get an answer 12-3=9 and (it can be proven) it is impossible to get less. 

<image>

It is optimal to project along the vector (1, -3) in the second example. The answer is 82/3-21/3=61/3 

<image>

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
struct point {
  long long x, y;
  point(long long xx, long long yy) {
    x = xx;
    y = yy;
  }
  point() {
    x = 0;
    y = 0;
  }
};
bool cmp(point a, point b) {
  if (a.x != b.x) return a.x < b.x;
  return a.y < b.y;
}
struct vec {
  long long a, b;
  vec() {
    a = 0;
    b = 0;
  }
  vec(int aa, int bb) {
    a = aa;
    b = bb;
  }
  vec(point x) {
    a = x.x;
    b = x.y;
  }
  vec(point x, point y) {
    a = y.x - x.x;
    b = y.y - x.y;
  }
};
long long cross(vec a, vec b) { return a.a * b.b - a.b * b.a; }
bool operator<(vec a, vec b) { return cross(a, b) > 0; }
bool operator<=(vec a, vec b) { return cross(a, b) >= 0; }
vec rev(vec a) { return vec(-a.a, -a.b); }
bool dw_ok(point a, point b, point c) {
  vec x1 = vec(a, b), x2 = vec(a, c);
  return cross(x1, x2) > 0;
}
bool up_ok(point a, point b, point c) {
  vec x1 = vec(a, b), x2 = vec(a, c);
  return cross(x1, x2) < 0;
}
bool cmpv(pair<vec, int> a, pair<vec, int> b) {
  return cross(a.first, b.first) > 0;
}
vector<point> p;
vector<point> hull;
vector<pair<vec, int>> upv, downv;
vec st_vec = vec(1, 0);
void make_hull() {
  sort(p.begin(), p.end(), cmp);
  vector<point> up, down;
  point st = p[0], fn = p[(int)p.size() - 1];
  up.push_back(st);
  down.push_back(st);
  vec d = vec(st, fn);
  for (int i = 1; i < (int)p.size(); i++) {
    vec cr = vec(st, p[i]);
    if (cross(d, cr) <= 0) {
      while ((int)down.size() > 1 && !dw_ok(down[(int)down.size() - 2],
                                            down[(int)down.size() - 1], p[i])) {
        down.pop_back();
      }
      if (i != (int)p.size() - 1) down.push_back(p[i]);
    }
    if (cross(d, cr) >= 0) {
      while ((int)up.size() > 1 &&
             !up_ok(up[(int)up.size() - 2], up[(int)up.size() - 1], p[i])) {
        up.pop_back();
      }
      if (i != (int)p.size() - 1) up.push_back(p[i]);
    }
  }
  hull.push_back(st);
  for (int i = 1; i < (int)down.size(); i++) {
    hull.push_back(down[i]);
  }
  hull.push_back(fn);
  for (int i = (int)up.size() - 1; i > 0; i--) {
    hull.push_back(up[i]);
  }
  vec beg, nd;
  for (int i = 0; i < (int)hull.size(); i++) {
    int nx = (i + 1) % ((int)hull.size());
    vec nv = vec(hull[i], hull[nx]);
    if (nv.b > 0) {
      upv.emplace_back(nv, i);
    }
    if (nv.b < 0) {
      downv.emplace_back(nv, i);
    }
    if (nv.b == 0) {
      if (nv.a > 0)
        downv.emplace_back(nv, i);
      else
        upv.emplace_back(nv, i);
    }
  }
  sort(upv.begin(), upv.end(), cmpv);
  sort(downv.begin(), downv.end(), cmpv);
  return;
}
point get(vec c) {
  assert(cross(st_vec, c) != 0);
  pair<vec, int> nc = make_pair(c, 0);
  if (cross(st_vec, c) > 0) {
    pair<vec, int> t = *lower_bound(upv.begin(), upv.end(), nc, cmpv);
    return hull[t.second];
  } else {
    pair<vec, int> t = *lower_bound(downv.begin(), downv.end(), nc, cmpv);
    return hull[t.second];
  }
}
int32_t main() {
  int n;
  cin >> n;
  vector<pair<point, point>> seg;
  for (int i = 0; i < n; i++) {
    int xx, xy, yy;
    cin >> xx >> xy >> yy;
    point p1 = point(xx, yy), p2 = point(xy, yy);
    seg.emplace_back(p1, p2);
    p.push_back(p1);
    p.push_back(p2);
  }
  make_hull();
  vector<vec> pos;
  vector<pair<vec, vec>> bad;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (seg[i].first.y <= seg[j].first.y) continue;
      vec v1 = vec(seg[i].second, seg[j].first),
          v2 = vec(seg[i].first, seg[j].second);
      bad.emplace_back(v1, v2);
    }
  }
  if (bad.size() == 0) {
    long long mn = 1e6 + 1, mx = -1e6;
    for (auto el : p) {
      mn = min(mn, el.x);
      mx = max(mx, el.x);
    }
    cout << mx - mn << endl;
    return 0;
  }
  sort(bad.begin(), bad.end());
  vector<pair<vec, vec>> scl;
  vec lft = bad[0].first, rght = bad[0].second;
  for (int i = 1; i < bad.size(); i++) {
    if (rght <= bad[i].first) {
      scl.emplace_back(lft, rght);
      lft = bad[i].first;
      rght = bad[i].second;
    } else {
      if (rght < bad[i].second) rght = bad[i].second;
    }
  }
  scl.emplace_back(lft, rght);
  for (auto el : scl) {
    pos.push_back(el.first);
    pos.push_back(el.second);
  }
  long double ans = 1e18;
  for (auto el : pos) {
    point p1 = get(el), p2 = get(rev(el));
    int h1 = p1.y, h2 = p2.y;
    double t1 = p1.x - ((double)el.a / (double)el.b) * h1,
           t2 = p2.x - ((double)el.a / (double)el.b) * h2;
    if (t2 - t1 < ans) {
      ans = t2 - t1;
    }
  }
  cout.precision(20);
  cout << ans << endl;
  return 0;
}