#include <bits/stdc++.h>
#define N 100005
#define ll long long
#define For(i,x,y) for(int i=(x);i<=(y);++i)
#define pll pair<ll,ll>
#define fr first
#define sd second
using namespace std;

pll a[N];
ll ansx=0,ansy=1,sum[N],S=0;
bool cmp(const pll &a,const pll &b){ return a.fr>b.fr; }
ll calc(int x,int y){ return y<=x?sum[x]-a[y].fr:sum[x]; }
ll gcd(ll x,ll y){ return x%y?gcd(y,x%y):y; }

int main(){
    int n; scanf("%d",&n);
    For(i,1,n){
        scanf("%lld%lld",&a[i].fr,&a[i].sd);
        S+=a[i].fr;
        a[i].fr=max(a[i].fr,a[i].sd);
    }
    sort(a+1,a+n+1,cmp);
    For(i,1,n) sum[i]=sum[i-1]+a[i].fr;
    For(i,1,n){
        int l=0,r=n,num=-1;
        while(l<=r){
            int mid=(l+r)>>1;
            if(calc(mid,i)>=S-a[i].sd) num=mid,r=mid-1;
            else l=mid+1;
        }
        if(num<0) continue;
        if(calc(num,i)>=S) continue;
        ll nowx=1ll*(1ll*n-(num-(i<=num)))*a[i].sd-S+calc(num,i),nowy=1ll*n*a[i].sd;
        ll p=gcd(nowx,nowy);nowx/=p,nowy/=p;
        if(1.0*nowx*ansy>1.0*nowy*ansx) ansx=nowx,ansy=nowy;        
    }
    printf("%lld %lld\n",ansx,ansy);
}
