#include <iomanip>
#include <iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    double a[n], p[n];
    for( int i = 0;  i < n;  i++)
    {
        cin >> a[i] >> p[i];
    }
    double temp;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n - i - 1; j++)
        {
            if (p[j] > p[j + 1])
            {
                temp = a[j + 1]; 
                a[j + 1] = a[j];
                a[j] = temp;
                temp = p[j + 1];
                p[j + 1] = p[j];
                p[j] = temp;
            }
        }
    }


    for (int i = 0; i < n; i++)
    {       
      cout<<a[i]<<" ";
    }
    cout<<endl;
    for (int i = 0; i < n; i++)
    {
      cout<<p[i]<<" ";
    }
  cout<<endl;

    double max = 0;
    int s=0;
    double vrednost=0;
    for (int i = 0; i < n; i++)
    {
        
        vrednost=0;
        for (int j = s; j < n; j++)
        {
          vrednost+=a[j]*p[i]/100;
        }
        if(max<vrednost)
        {
          max=vrednost;
        }  
        s++;
    }
    cout << setprecision (4) << fixed << max;

}