#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e3 + 5;
const long double inf = 3e12;
long double R[maxn], L[maxn], y[maxn];
int A[maxn], ps[maxn * maxn];
bool cmp(int a, int b) { return y[a] > y[b] || (y[a] == y[b] && R[a] > R[b]); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int l, r, Y;
    cin >> l >> r >> Y;
    L[i] = l;
    R[i] = r;
    y[i] = Y;
  }
  vector<long double> can;
  can.push_back(0);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (y[i] <= y[j]) continue;
      can.push_back((L[i] - R[j]) / (y[i] - y[j]));
      can.push_back((R[i] - L[j]) / (y[i] - y[j]));
    }
    A[i] = i;
  }
  sort(can.begin(), can.end());
  can.resize(unique(can.begin(), can.end()) - can.begin());
  int sz = can.size();
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (y[i] <= y[j]) continue;
      ps[lower_bound(can.begin(), can.end(), (L[i] - R[j]) / (y[i] - y[j])) -
         can.begin() + 1]++;
      ps[lower_bound(can.begin(), can.end(), (R[i] - L[j]) / (y[i] - y[j])) -
         can.begin()]--;
    }
  }
  for (int i = 1; i < sz; i++) ps[i] += ps[i - 1];
  sort(A, A + n, cmp);
  vector<long double> RRC;
  vector<int> RR;
  for (int idx = 0; idx < n; idx++) {
    int i = A[idx];
    if (idx && y[A[idx - 1]] == y[i]) continue;
    if (!RR.size()) {
      RRC.push_back(-inf);
      RR.push_back(i);
    } else {
      int j = RR.back();
      long double T = (R[i] - R[j]) / (y[i] - y[j]);
      while (RR.size() && T < RRC.back()) {
        RR.pop_back();
        RRC.pop_back();
        if (RR.size()) {
          j = RR.back();
          T = (R[i] - R[j]) / (y[i] - y[j]);
        } else
          T = -inf;
      }
      RRC.push_back(T);
      RR.push_back(i);
    }
  }
  vector<long double> LLC;
  vector<int> LL;
  for (int idx = n - 1; ~idx; idx--) {
    int i = A[idx];
    if (idx < n - 1 && y[A[idx + 1]] == y[i]) continue;
    if (!LL.size()) {
      LLC.push_back(-inf);
      LL.push_back(i);
    } else {
      int j = LL.back();
      long double T = (L[i] - L[j]) / (y[i] - y[j]);
      while (LL.size() && T < LLC.back()) {
        LL.pop_back();
        LLC.pop_back();
        if (LL.size()) {
          j = LL.back();
          T = (L[i] - L[j]) / (y[i] - y[j]);
        } else
          T = -inf;
      }
      LLC.push_back((L[i] - L[j]) / (y[i] - y[j]));
      LL.push_back(i);
    }
  }
  long double ans = inf;
  int x = -1, t = -1;
  for (int i = 0; i < sz; i++) {
    if (ps[i]) continue;
    long double T = can[i];
    x = upper_bound(LLC.begin() + x + 1, LLC.end(), T) - LLC.begin() - 1;
    t = upper_bound(RRC.begin() + t + 1, RRC.end(), T) - RRC.begin() - 1;
    ans = min(ans, R[RR[t]] - (y[RR[t]] * T) - L[LL[x]] + (y[LL[x]] * T));
  }
  cout << setprecision(7) << ans;
}
