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;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f3f3f3f3f3f3fll;
const long long M = 1e9 + 7;
const long long maxn = 1e6 + 107;
const double pi = acos(-1.0);
const double eps = 0.0000000001;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
template <typename T>
inline void pr2(T x, int k = 64) {
  long long i;
  for (i = 0; i < k; i++) fprintf(stderr, "%d", (x >> i) & 1);
  putchar(' ');
}
template <typename T>
inline void add_(T &A, int B, long long MOD = M) {
  A += B;
  (A >= MOD) && (A -= MOD);
}
template <typename T>
inline void mul_(T &A, long long B, long long MOD = M) {
  A = (A * B) % MOD;
}
template <typename T>
inline void mod_(T &A, long long MOD = M) {
  A %= MOD;
  A += MOD;
  A %= MOD;
}
template <typename T>
inline void max_(T &A, T B) {
  (A < B) && (A = B);
}
template <typename T>
inline void min_(T &A, T B) {
  (A > B) && (A = B);
}
template <typename T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
inline long long powMM(long long a, long long b, long long mod = M) {
  long long ret = 1;
  for (; b; b >>= 1ll, a = a * a % mod)
    if (b & 1) ret = ret * a % mod;
  return ret;
}
int startTime;
void startTimer() { startTime = clock(); }
void printTimer() {
  fprintf(stderr, "/--- Time: %ld milliseconds ---/\n", clock() - startTime);
}
struct frac {
  long long x, y;
  frac(long long _x, long long _y) {
    if (_y < 0)
      _x = -_x, _y = -_y;
    else if (_y == 0)
      _x = abs(_x);
    x = _x;
    y = _y;
  }
  void norm() {
    long long d = gcd(abs(x), abs(y));
    x /= d;
    y /= d;
  }
  bool operator<(const frac &k) const { return x * k.y < k.x * y; }
  bool operator<=(const frac &k) const { return x * k.y <= k.x * y; }
  bool operator!=(const frac &k) const { return x * k.y != k.x * y; }
  double value() { return 1.0 * x / y; }
};
struct point_rotate {
  struct point {
    int x, y;
    int id;
  } T[maxn];
  int start;
  vector<pair<frac, pair<int, int> > > changes;
  int pos_id[maxn], n;
  void init_direct(int _n) {
    int i, j;
    n = _n;
    start = 0;
    changes.clear();
    for (i = 1; i <= n; i++) T[i].id = i;
    sort(T + 1, T + 1 + n, [](point &a, point &b) {
      if (a.x != b.x) return a.x > b.x;
      return a.y > b.y;
    });
    for (i = 1; i <= n; i++) pos_id[T[i].id] = i;
    for (i = 1; i <= n; i++)
      for (j = i + 1; j <= n; j++)
        if (T[i].x != T[j].x) {
          changes.push_back(make_pair(frac(T[i].y - T[j].y, T[i].x - T[j].x),
                                      make_pair(i, j)));
        }
    sort(changes.begin(), changes.end());
    for (auto &now : changes) {
      pair<int, int> id = now.second;
      now.second = make_pair(T[id.first].id, T[id.second].id);
    }
  }
  void init_rotate(int n) {
    int i;
    for (i = 1; i <= n; i++) swap(T[i].x, T[i].y);
    init_direct(n);
  }
  void change(frac k) {
    for (; start < (int)changes.size() && changes[start].first <= k; start++) {
      pair<int, int> pos = changes[start].second;
      int x = pos.first, y = pos.second;
      swap(T[pos_id[y]], T[pos_id[x]]);
      swap(pos_id[y], pos_id[x]);
    }
  }
  void print(frac k) {
    int i;
    for (i = 1; i <= n; i++)
      printf("%lld(%d) ", T[i].x * k.x - T[i].y * k.y, T[i].id);
    printf(" <- position_direct; x*y=%lld;, k=%f\n", k.x * k.y, k.value());
  }
} P;
int Y[maxn], L[maxn], R[maxn];
int cnt;
vector<pair<frac, int> > ks;
double getpos(int x, int y, frac p) {
  if (!p.y) return x;
  return 1.0 * (x * p.y - y * p.x) / p.y;
}
int inter[maxn];
int id[maxn], ini[maxn];
int main() {
  int i, j;
  int n;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d%d%d", &L[i], &R[i], &Y[i]);
    P.T[i].x = L[i];
    P.T[i].y = Y[i];
    P.T[i + n].x = R[i];
    P.T[i + n].y = Y[i];
  }
  P.init_rotate(n * 2);
  for (i = 1; i <= n; i++)
    for (j = i + 1; j <= n; j++) {
      if (Y[i] == Y[j]) continue;
      {
        frac l(L[i] - R[j], Y[i] - Y[j]);
        frac r(R[i] - L[j], Y[i] - Y[j]);
        if (Y[i] > Y[j]) swap(l, r);
        ks.push_back(make_pair(l, -1));
        ks.push_back(make_pair(r, 1));
      }
    }
  if (!(ks.size())) ks.push_back(make_pair(frac(1, 0), 0));
  sort(ks.begin(), ks.end());
  double ans = INFF;
  for (auto now : ks) {
    P.change(now.first);
    bool ok = 0;
    ok |= cnt == 0;
    cnt += now.second;
    ok |= cnt == 0;
    if (ok) {
      double l = getpos(P.T[1].y, P.T[1].x, now.first);
      double r = getpos(P.T[n * 2].y, P.T[n * 2].x, now.first);
      min_(ans, abs(r - l));
    }
  }
  printf("%.12f\n", ans);
}