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>
std::mt19937_64 rng(
    std::chrono::steady_clock::now().time_since_epoch().count());
using namespace std;
long long A1, B1, A2, B2;
int mtksz, stksz;
inline bool intersect(pair<long long, long long> p1,
                      pair<long long, long long> p2,
                      pair<long long, long long> p3) {
  A1 = p1.second - p2.second;
  B1 = p2.first - p1.first;
  if (B1 < 0) {
    A1 *= -1;
    B1 *= -1;
  }
  A2 = p1.second - p3.second;
  B2 = p3.first - p1.first;
  if (B2 < 0) {
    A2 *= -1;
    B2 *= -1;
  }
  return A1 * B2 > A2 * B1;
}
vector<pair<long double, long double> > stk(4005), mtk(4005);
int L, R, mid;
long double mini, cur, next, maxi;
int cnt = 0;
inline long double convex_min(long double z) {
  L = 0;
  R = stksz;
  mini = LLONG_MAX;
  while (L < R) {
    mid = (L + R) / 2;
    mini = min(mini, z * stk[mid].first + stk[mid].second);
    if (z * stk[mid].first + stk[mid].second <
        z * stk[mid + 1].first + stk[mid + 1].second) {
      mini = min(mini, z * stk[mid].first + stk[mid].second);
      R = mid;
    } else {
      mini = min(mini, z * stk[mid + 1].first + stk[mid + 1].second);
      L = mid + 1;
    }
  }
  return mini;
}
inline long double convex_max(long double z) {
  L = 0;
  R = mtksz;
  maxi = LLONG_MIN;
  while (L < R) {
    mid = (L + R) / 2;
    maxi = max(mini, z * mtk[mid].first + mtk[mid].second);
    if (z * mtk[mid].first + mtk[mid].second >
        z * mtk[mid + 1].first + mtk[mid + 1].second) {
      maxi = max(mini, z * mtk[mid].first + mtk[mid].second);
      R = mid;
    } else {
      maxi = max(mini, z * mtk[mid + 1].first + mtk[mid + 1].second);
      L = mid + 1;
    }
  }
  return maxi;
}
inline vector<pair<long double, long double> > merge_Intervals(
    vector<pair<long double, long double> > &forbid) {
  sort(forbid.begin(), forbid.end());
  vector<pair<long double, long double> > ss;
  if (forbid.size() == 0) return ss;
  ss.push_back(forbid[0]);
  for (int i = 0; i < forbid.size(); i++) {
    if (ss.back().second <= forbid[i].first)
      ss.push_back(forbid[i]);
    else if (ss.back().second < forbid[i].second) {
      ss.back().second = forbid[i].second;
    }
  }
  return ss;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    long long n;
    cin >> n;
    vector<pair<pair<long double, long double>, long double> > v;
    long double x, y, z;
    for (long long i = 0; i < n; i++) {
      cin >> x >> y >> z;
      v.push_back({{x, y}, z});
    }
    sort(v.begin(), v.end());
    long double ans = LLONG_MAX;
    vector<long double> xx;
    vector<pair<long double, long double> > forbid;
    long double z1, z2, den1, den2, pos = LLONG_MAX, neg = LLONG_MIN;
    vector<pair<long long, long long> > lines;
    for (long long gg = 0; gg < n; gg++) {
      lines.push_back({v[gg].second, v[gg].first.first});
      lines.push_back({v[gg].second, v[gg].first.second});
      for (long long i = gg + 1; i < n; i++) {
        if (v[i].second == v[gg].second) {
          continue;
        }
        z1 = (v[i].second - v[gg].second) /
             (v[i].first.first - v[gg].first.second);
        z2 = (v[gg].second - v[i].second) /
             (v[gg].first.first - v[i].first.second);
        den1 = (v[i].first.first - v[gg].first.second);
        den2 = (v[gg].first.first - v[i].first.second);
        if (z1 > 0 and z2 > 0 and den1 != 0 and den2 != 0)
          forbid.push_back({min(z1, z2), max(z1, z2)});
        else if (z1 < 0 and z2 < 0 and den2 != 0 and den1 != 0)
          forbid.push_back({min(z1, z2), max(z1, z2)});
        else if (den1 == 0.0 and den2 != 0) {
          if (z2 > 0)
            forbid.push_back({z2, pos});
          else
            forbid.push_back({neg, z2});
        } else if (den2 == 0.0 and den1 != 0) {
          if (z1 > 0)
            forbid.push_back({z1, pos});
          else
            forbid.push_back({neg, z1});
        } else {
          forbid.push_back({neg, min(z1, z2)});
          forbid.push_back({max(z1, z2), pos});
        }
      }
    }
    sort(lines.begin(), lines.end());
    reverse(lines.begin(), lines.end());
    stk[stksz] = lines[0];
    for (long long i = 1; i < lines.size(); i++) {
      while (stksz != -1 and stk[stksz].first == lines[i].first and
             stk[stksz].second > lines[i].second)
        stksz--;
      while (stksz >= 1 and intersect(stk[stksz - 1], stk[stksz], lines[i]))
        stksz--;
      if (stksz == -1) {
        stksz++;
        stk[stksz] = lines[i];
        continue;
      }
      if (stk[stksz].first != lines[i].first) {
        stksz++;
        stk[stksz] = lines[i];
      }
    }
    mtk[mtksz] = lines[0];
    for (long long i = 1; i < lines.size(); i++) {
      while (mtksz != -1 and mtk[mtksz].first == lines[i].first and
             mtk[mtksz].second < lines[i].second)
        mtksz--;
      while (mtksz >= 1 and !intersect(mtk[mtksz - 1], mtk[mtksz], lines[i]))
        mtksz--;
      if (mtksz == -1) {
        mtksz++;
        mtk[mtksz] = lines[i];
        continue;
      }
      if (mtk[mtksz].first != lines[i].first) {
        mtksz++;
        mtk[mtksz] = lines[i];
      }
    }
    vector<pair<long double, long double> > interval = merge_Intervals(forbid);
    for (int i = 0; i < interval.size(); i++) {
      xx.push_back(interval[i].first);
      xx.push_back(interval[i].second);
    }
    vector<long double>::iterator low, up;
    long long sz1, sz2;
    for (long long i = 0; i < xx.size(); i++) {
      if (xx[i] == pos or xx[i] == neg) continue;
      x = convex_min(-1 / xx[i]);
      y = convex_max(-1 / xx[i]);
      ans = min(ans, y - x);
    }
    long long rr = 1;
    for (long long i = 1; i < n; i++)
      if (v[i - 1].first.second > v[i].first.first) rr = 0;
    if (rr) {
      ans = min(ans, v[n - 1].first.second - v[0].first.first);
    }
    cout << setprecision(15) << ans;
  }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}