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 __64inf = 0x3f3f3f3f3f3f3f3f;
const int MAX = 1e6 + 50;
const int mod = 998244353;
void file_read() {}
struct Seg {
  double xl, xr, y;
  Seg(double xl, double xr, double y) : xl(xl), xr(xr), y(y) {}
};
vector<Seg> seg;
vector<pair<double, double>> bd;
void bound() {
  for (int i = 0; i < seg.size(); i++) {
    for (int j = i + 1; j < seg.size(); j++) {
      if (seg[i].y == seg[j].y) continue;
      auto s1 = seg[i];
      auto s2 = seg[j];
      if (s1.y > s2.y) swap(s1, s2);
      double beta1 = (s1.xr - s2.xl) / (s2.y - s1.y);
      double beta2 = (s1.xl - s2.xr) / (s2.y - s1.y);
      bd.emplace_back(beta2, beta1);
    }
  }
}
void filter(vector<double> &theta) {
  double cur = -__64inf;
  for (auto x : bd) {
    if (x.first >= cur) {
      theta.push_back(x.first);
      if (cur > -__64inf) theta.push_back(cur);
    }
    cur = max(cur, x.second);
  }
  theta.push_back(cur);
}
double cross(pair<double, double> A, pair<double, double> B) {
  return (A.first - B.first) / (B.second - A.second);
}
template <typename Cmp_1, typename Cmp_2>
struct Convex {
  int top;
  vector<pair<double, double>> pts;
  vector<double> X;
  pair<double, double> stk[3000];
  Cmp_1 cmp_1;
  Cmp_2 cmp_2;
  Convex(vector<Seg> &seg) : cmp_1(Cmp_1()), cmp_2(Cmp_2()) {
    for (auto s : seg) {
      pts.emplace_back(s.xl, s.y);
      pts.emplace_back(s.xr, s.y);
    }
    sort(pts.begin(), pts.end(),
         [this](const pair<double, double> &A, const pair<double, double> &B) {
           if (abs(A.second - B.second) < 1e-8)
             return this->cmp_1(A.first, B.first);
           return this->cmp_2(A.second, B.second);
         });
    int i = 0;
    top = 0;
    stk[top++] = pts[0];
    while (i < pts.size() and abs(pts[i].second - pts[0].second) < 1e-8) i++;
    if (i == pts.size()) {
      X.push_back(-__64inf);
      return;
    }
    stk[top++] = pts[i++];
    while (i < pts.size()) {
      int j = i;
      while (j < pts.size() and abs(pts[j].second - pts[i].second) < 1e-8) j++;
      if (j == pts.size()) break;
      auto cur = pts[j];
      while (top >= 2) {
        double cross_x = cross(stk[top - 1], stk[top - 2]);
        double cross_cur = cross(cur, stk[top - 2]);
        if (cross_cur < cross_x)
          top--;
        else
          break;
      }
      stk[top++] = cur;
      i = j + 1;
    }
    X.push_back(-__64inf);
    for (int i = 1; i < top; i++) {
      X.push_back(cross(stk[i - 1], stk[i]));
    }
  }
  double query(double a) {
    int idx = lower_bound(X.begin(), X.end(), a) - X.begin();
    idx--;
    return stk[idx].first + stk[idx].second * a;
  }
};
struct Less {
  bool operator()(double A, double B) { return A < B; }
};
struct Great {
  bool operator()(double A, double B) { return A > B; }
};
int main() {
  int n;
  scanf("%d", &n);
  set<double> Y;
  for (int i = 0; i < n; i++) {
    double xl, xr, y;
    scanf("%lf%lf%lf", &xl, &xr, &y);
    seg.emplace_back(xl, xr, y);
    Y.insert(y);
  }
  if (Y.size() == 1) {
    double Min = __64inf, Max = -__64inf;
    for (auto s : seg) {
      Min = min(s.xl, Min);
      Max = max(Max, s.xr);
    }
    printf("%.10f\n", Max - Min);
    return 0;
  }
  bound();
  vector<double> theta;
  sort(bd.begin(), bd.end());
  filter(theta);
  double ans = __64inf;
  Convex<Less, Great> left(seg);
  Convex<Great, Less> right(seg);
  for (auto x : theta) {
    double l = left.query(x);
    double r = right.query(x);
    ans = min(ans, r - l);
  }
  printf("%.10f\n", ans);
}