#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
const int N = 200010;
#define int long long
int n;
struct node
{
int z,x,y;
bool operator < (const node & W)const
{
return z<W.z;
}
}a[N];
bool cmp(node a,node b)
{
return a.y<b.y;
}
signed main()
{
priority_queue<node>heap;
cin>>n;
for(int i=1;i<=n;i++)
{
int z,x,y;cin>>z>>x>>y;
a[i]={z,x,y};
}
sort(a+1,a+n+1,cmp);
int tmp=0;
double res=0.0;
for(int i=1;i<=n;i++)
{
heap.push(a[i]);
tmp+=a[i].x;
if(tmp>a[i].y)
{
int num=tmp-a[i].y;
tmp=a[i].y;
while(heap.size())
{
if(num==0)break;
auto t=heap.top();heap.pop();
if(num>t.x)
{
res+=(double)t.x*1.0/t.z;
num-=t.x;
}
else
{
res+=(double)num*1.0/t.z;
t.x-=num;
heap.push(t);
num=0;
}
}
}
}
printf("%.1lf\n",res);
}