#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
template<class A, class B>
ostream& operator<<(ostream& os, const pair<A, B> &p) {
os << '(' << p.first << ',' << p.second << ')';
return os;
}
template<class T, long long unsigned int size>
ostream& operator<<(ostream& os, const array<T, size> &arr) {
os << '{';
bool osu = 1;
for (auto &i : arr) { if (!osu) os << ','; os << i; osu = 0; }
os << '}';
return os;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T> &v) {
os << '{';
bool osu = 1;
for (auto &i : v) { if (!osu) os << ','; os << i; osu = 0; }
os << '}';
return os;
}
template<class T>
ostream& operator<<(ostream& os, const deque<T> &v) {
os << '{';
bool osu = 1;
for (auto &i : v) { if (!osu) os << ','; os << i; osu = 0; }
os << '}';
return os;
}
#define debug(...) logger(#__VA_ARGS__, __VA_ARGS__)
template <typename... Args>
void logger(string vars, Args &&...values)
{
cout << "[ ";
cout << vars << " = ";
string delim = "";
(..., (cout << delim << values, delim = ", "));
cout << " ]\n";
}
#define ll long long
#define ull unsigned long long
#define lll __int128
#define rep(i,n,N) for(int i=(n);i<=(N);++i)
#define For(i,n,N) for(int i=(n);i< (N);++i)
#define rap(i,n,N) for(int i=(n);i>=(N);--i)
#define rip(i,n,N,V) for(int i=(n);i<=(N);i+=V)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
//#define le left
//#define ri right
#define fi first
#define se second
//#define ff fi.fi
//#define fs fi.se
//#define sf se.fi
//#define ss se.se
#define lc (id<<1)
#define rc ((id<<1)|1)
#define ou3(x,y,z) cout << ">> " << (x) << " " << (y) << " " << (z) << endl
#define mems(x,y) memset(&x,y,sizeof x)
#define memsv(x,y) memset(&x[0], y, sizeof(x[0]) * x.size())
#define popcount __builtin_popcountll
#define clz(x) (1<<(31-__builtin_clz(x)))
#define clzll(x) (1LL<<(63-__builtin_clzll(x)))
#define all(x) x.begin(),x.end()
#define rsort(x) sort(x), reverse(x)
#define revsort(a,b) sort(a,b), reverse(a,b)
#define PQ(T) priority_queue<T>
#define PQr(T) priority_queue<T, vector<T>, greater<T>>
#define permute(x) while(next_permutation(all(x)))
#define distinct(x) x.erase(unique(all(x)),x.end())
#define vi vector<int>
#define vvi vector<vi>
#define vii vector<pii>
#define vll vector<ll>
#define vlll vector<pll>
#define vvll vector<vll>
#define ari(x) array<int,x>
#define arll(x) array<ll,x>
#define ard(x) array<double,x>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define plll pair<ll,pll>
#define pllll pair<pll,pll>
#define piii pair<int,pii>
#define piiii pair<pii,pii>
#define psi pair<string,int>
#define endl '\n'
const int MAX = 3e3+5;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll INF = 2e18;
const int dr[] = { 1,0,-1,0,1,1,-1,-1 };
const int dc[] = { 0,-1,0,1,1,-1,1,-1 };
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 2048;
inline ll pw(ll x, ll y, ll md = MOD) { ll ret = 1; x %= md; while (y) { if (y & 1)ret = ret * x%md; x = x * x%md, y >>= 1; }return ret; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int n;
double h[MAX],ans;
ari(3) x[MAX];
int main() {
cout<<fixed<<setprecision(10);
freopen("input.txt", "r", stdin);
freopen("output.txt","w",stdout);
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin>>n;
rep(i,1,n)rep(j,0,2)cin>>x[i][j];
ans = x[1][0];
rep(i,2,n){
For(j,1,i){
if(x[i][1] >= x[j][2]){
h[i] = max(h[i], h[j] + x[j][0]);
continue;
}
double b1 = x[j][1], t1 = x[j][2];
double b2 = x[i][1], t2 = x[i][2];
if(x[i][1] <= x[j][1]){
h[i] = max(h[i], h[j]);
}
else {
h[i] = max(h[i], h[j] + x[j][0] * (b2 - b1) / (t1 - b1));
}
if(x[i][2] <= x[j][2]){
h[i] = max(h[i], h[j] + x[j][0] * (t2 - b1) / (t1 - b1) - x[i][0]);
}
else {
h[i] = max(h[i], h[j] + x[j][0] - x[i][0] * (t1 - b2) / (t2 - b2));
}
}
ans = max(ans, h[i] + x[i][0]);
}
cout<<ans<<endl;
return 0;
}