#include <bits/stdc++.h>
using namespace std;
#define ll long long
int a[100005];
int b[100005];
int n;

struct st
{
    int x,y,z;
}c[100005];

ll d[100005];

bool cmp(st a,st b)
{
    return a.x<b.x;
}

struct frac
{
    ll x,y;
    frac(){}
    frac(ll _x,ll _y)
    {
        ll g=__gcd(_x,_y);
        x=_x/g;
        y=_y/g;
    }
};
bool operator<(frac a,frac b)
{
    return a.x*b.y<b.x*a.y;
}


int main()
{
    scanf("%d",&n);
    ll cost=0;
    for (int i=1;i<=n;i++)
    {
        scanf("%d%d",&a[i],&b[i]);
        cost+=max(b[i]-a[i],0);
        c[i].x=max(a[i],b[i]);
        c[i].y=a[i];
        c[i].z=b[i];
    }
    sort(c+1,c+n+1,cmp);
    for (int i=1;i<=n;i++)
    {
        d[i]=d[i-1]+c[i].x;
    }
    int cnt=n;
    for (int i=1;i<=n;i++)
    {
        if (cost-d[i-1]<0)
        {
            cnt=i-1;
            break;
        }
    }
    cost-=d[cnt-1];
    frac ma(0,1);
    for (int i=cnt;i<=n;i++)
    {
        if (c[i].y<=c[i].z)
        {
            ma=max(ma,frac(cost,c[i].z));
        }
        else
        {
            if (cost-c[i].y+c[i].z>0)
            {
                ma=max(ma,frac(cost-c[i].y+c[i].z,c[i].z));
            }
        }
    }
    for (int i=1;i<cnt;i++)
    {
        ll x=cost-d[cnt]+d[i];
        if (c[i].y<=c[i].z)
        {
            if (x>0)
            {
                ma=max(ma,frac(x,c[i].z));
            }
        }
        else
        {
            if (x-c[i].y+c[i].z>0)
            {
                ma=max(ma,frac(x-c[i].y+c[i].z,c[i].z));
            }
        }
    }
    ma.x+=(cnt-1)*ma.y;
    ma.y*=n;
    ma=frac(ma.x,ma.y);
    cout<<ma.x<<' '<<ma.y<<endl;
    return 0;
}
