#include<bits/stdc++.h>
using namespace std;
const int N =110, M = 10010;
int n;
int f[N][M];
struct Stone{
int s, e, l;
}stone[N];
bool cmp(Stone a, Stone b){
return a.s * b.l < b.s * a.l;
#include<bits/stdc++.h>
using namespace std;
const int N =110, M = 10010;
int n;
int f[N][M];
struct Stone{
int s, e, l;
}stone[N];
bool cmp(Stone a, Stone b){
return a.s * b.l < b.s * a.l;