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>
long long dx[8] = {0, 1, 0, -1, 1, 1, -1, -1};
long long dy[8] = {1, 0, -1, 0, -1, 1, 1, -1};
using namespace std;
class pa3 {
 public:
  long long x;
  long long y, z;
  pa3(long long x = 0, long long y = 0, long long z = 0) : x(x), y(y), z(z) {}
  bool operator<(const pa3 &p) const {
    if (x != p.x) return x < p.x;
    if (y != p.y) return y < p.y;
    return z < p.z;
  }
  bool operator>(const pa3 &p) const {
    if (x != p.x) return x > p.x;
    if (y != p.y) return y > p.y;
    return z > p.z;
  }
  bool operator==(const pa3 &p) const {
    return x == p.x && y == p.y && z == p.z;
  }
  bool operator!=(const pa3 &p) const {
    return !(x == p.x && y == p.y && z == p.z);
  }
};
class pa4 {
 public:
  long long x;
  long long y, z, w;
  pa4(long long x = 0, long long y = 0, long long z = 0, long long w = 0)
      : x(x), y(y), z(z), w(w) {}
  bool operator<(const pa4 &p) const {
    if (x != p.x) return x < p.x;
    if (y != p.y) return y < p.y;
    if (z != p.z) return z < p.z;
    return w < p.w;
  }
  bool operator>(const pa4 &p) const {
    if (x != p.x) return x > p.x;
    if (y != p.y) return y > p.y;
    if (z != p.z) return z > p.z;
    return w > p.w;
  }
  bool operator==(const pa4 &p) const {
    return x == p.x && y == p.y && z == p.z && w == p.w;
  }
};
class pa2 {
 public:
  long long x, y;
  pa2(long long x = 0, long long y = 0) : x(x), y(y) {}
  pa2 operator+(pa2 p) { return pa2(x + p.x, y + p.y); }
  pa2 operator-(pa2 p) { return pa2(x - p.x, y - p.y); }
  bool operator<(const pa2 &p) const { return y != p.y ? y < p.y : x < p.x; }
  bool operator>(const pa2 &p) const { return x != p.x ? x < p.x : y < p.y; }
  bool operator==(const pa2 &p) const {
    return abs(x - p.x) == 0 && abs(y - p.y) == 0;
  }
  bool operator!=(const pa2 &p) const {
    return !(abs(x - p.x) == 0 && abs(y - p.y) == 0);
  }
};
string itos(long long i) {
  ostringstream s;
  s << i;
  return s.str();
}
long long Gcd(long long v, long long b) {
  if (v == 0) return b;
  if (b == 0) return v;
  if (v > b) return Gcd(b, v);
  if (v == b) return b;
  if (b % v == 0) return v;
  return Gcd(v, b % v);
}
long long mod;
long long extgcd(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long d = extgcd(b, a % b, y, x);
  y -= a / b * x;
  return d;
}
pair<long long, long long> operator+(const pair<long long, long long> &l,
                                     const pair<long long, long long> &r) {
  return {l.first + r.first, l.second + r.second};
}
pair<long long, long long> operator-(const pair<long long, long long> &l,
                                     const pair<long long, long long> &r) {
  return {l.first - r.first, l.second - r.second};
}
long long beki(long long wa, long long rr, long long warukazu) {
  if (rr == 0) return 1 % warukazu;
  if (rr == 1) return wa % warukazu;
  wa %= warukazu;
  if (rr % 2 == 1)
    return ((long long)beki(wa, rr - 1, warukazu) * (long long)wa) % warukazu;
  long long zx = beki(wa, rr / 2, warukazu);
  return (zx * zx) % warukazu;
}
long long pr[100000];
long long inv[100000];
long long comb(long long nn, long long rr) {
  if (rr < 0 || rr > nn || nn < 0) return 0;
  long long r = pr[nn] * inv[rr];
  r %= mod;
  r *= inv[nn - rr];
  r %= mod;
  return r;
}
void gya(long long ert) {
  pr[0] = 1;
  for (long long i = 1; i <= ert; i++) {
    pr[i] = ((long long)pr[i - 1] * i) % mod;
  }
  inv[ert] = beki(pr[ert], mod - 2, mod);
  for (long long i = ert - 1; i >= 0; i--) {
    inv[i] = (long long)inv[i + 1] * (i + 1) % mod;
  }
}
struct fruc {
 private:
 public:
  long long b, s;
  fruc(long long bunbo, long long bunsi) {
    if (bunsi == 0) {
      this->s = 0;
      this->b = 1;
    } else {
      if (bunbo < 0) {
        bunbo *= -1, bunsi *= -1;
      }
      this->s = bunsi;
      this->b = bunbo;
    }
  }
  bool operator<(const fruc &f) const { return s * f.b < b * f.s; }
  bool operator<=(const fruc &f) const { return s * f.b <= b * f.s; }
  bool operator>(const fruc &f) const { return s * f.b > b * f.s; }
  bool operator>=(const fruc &f) const { return s * f.b >= b * f.s; }
  bool operator==(const fruc &f) const { return s * f.b == b * f.s; }
  bool operator!=(const fruc &f) const { return s * f.b != b * f.s; }
  double fruc_to_double() { return (s + 0.0) / b; }
};
long long a[20020], b[20020], c[20020];
double ch(double p, long long n) {
  double ma = -1e30;
  double mi = 1e30;
  for (long long i = 0; i < n; i++) {
    ma = max(ma, (double)b[i] + c[i] * p);
    mi = min(mi, (double)a[i] + c[i] * p);
  }
  return ma - mi;
}
void solve() {
  long long n;
  cin >> n;
  vector<pair<fruc, fruc>> ve;
  for (long long i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i];
  for (long long i = 0; i < n; i++)
    for (long long j = i + 1; j < n; j++)
      if (c[i] != c[j]) {
        if (c[i] < c[j]) {
          long long x = a[i] - b[j];
          long long y = c[j] - c[i];
          long long g = 1;
          fruc R(y / g, x / g);
          long long xx = b[i] - a[j];
          long long gg = 1;
          fruc S(y / gg, xx / gg);
          ve.push_back(make_pair(R, S));
        } else {
          long long x = a[j] - b[i];
          long long y = c[i] - c[j];
          long long g = 1;
          fruc R(y / g, x / g);
          long long xx = b[j] - a[i];
          long long gg = 1;
          fruc S(y / gg, xx / gg);
          ve.push_back(make_pair(R, S));
        }
      }
  vector<pair<fruc, long long>> e;
  for (auto v : ve) {
    e.push_back(make_pair(v.first, 1));
    e.push_back(make_pair(v.second, -1));
  }
  sort(e.begin(), e.end());
  vector<fruc> po;
  long long cnt = 0;
  for (auto v : e) {
    if (v.second == -1) {
      cnt--;
      if (cnt == 0) {
        if (po.size() == 0 || po.back() != v.first) po.push_back(v.first);
      }
    } else {
      if (cnt == 0) {
        if (po.size() == 0 || po.back() != v.first) po.push_back(v.first);
      }
      cnt++;
    }
  }
  double si = -10000000;
  double ue = 10000000;
  for (long long i = 0; i < 50; i++) {
    double m1 = (2 * si + ue) / 3.0;
    double m2 = (si + ue * 2) / 3.0;
    if (ch(m1, n) > ch(m2, n))
      si = m1;
    else
      ue = m2;
  }
  bool dame = 0;
  vector<long long> hoge(cnt + 10, 0);
  for (auto v : ve) {
    if (v.first.fruc_to_double() < si and si < v.second.fruc_to_double())
      dame = 1;
  }
  if (!dame) {
    printf("%.10lf\n", ch(si, n));
    return;
  }
  fruc fu(-1, 2000020);
  fruc sei(1, 2000020);
  for (long long i = 0; i < po.size(); i++) {
    if (po[i].fruc_to_double() <= si) {
      fu = max(fu, po[i]);
    }
    if (po[i].fruc_to_double() >= si) {
      sei = min(sei, po[i]);
    }
  }
  double w1 = 1e30, w2 = -(1e30);
  double dfu = fu.fruc_to_double();
  for (long long i = 0; i < n; i++) {
    w1 = min(dfu * c[i] + a[i], w1);
    w2 = max(dfu * c[i] + b[i], w2);
  }
  double v1 = 1e30, v2 = -(1e30);
  double dsei = sei.fruc_to_double();
  for (long long i = 0; i < n; i++) {
    v1 = min(dsei * c[i] + a[i], v1);
    v2 = max(dsei * c[i] + b[i], v2);
  }
  printf("%.10lf\n", min(v2 - v1, w2 - w1));
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n = 1;
  for (long long i = 0; i < n; i++) solve();
  return 0;
}