#include<bits/stdc++.h>
using namespace std;
int f(float niz[], int l, int r, float x) 
{ 
    if (r >= l) { 
    int s = l + (r - l) / 2;
    if (niz[s] == x) 
    return s; 
    if (niz[s] > x) 
    return f(niz, l, s - 1, x); 
    return f(niz, s + 1, r, x); 
    }
    return -1; 
} 
int main ()
{
	long long n, i=0;
	float x=0.0000;
	cin>>n;
	long long niz[n];
	long long niz1[n];
	float niz2[n];
	float niz3[n];
	while(i<n)cin>>niz[i],niz1[i]=niz[i],cin>>niz2[i],niz2[i]=niz2[i]/100, niz3[i]=niz2[i], i++;
	sort(niz2, niz2+n);i=0;
	while(i<n)niz[f(niz2, 0, n, niz3[i])]=niz1[i],i++;
	i=0;
	while(i<n)x=x+niz[i], i++;
	i=0;
	float maks=x*niz2[0];
	cout<<maks<<endl;
	while(i<n-1)
	{
		x=x-niz[i];
		if(x*niz2[i+1]>maks)maks=x*niz2[i+1];
		cout<<x<<" "<<niz2[i+1]<<" "<<maks<<endl;
		i++;
	}
	cout<<maks;
	return 0;
}