//Zory-2019
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pr pair<int,int>
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#ifdef DEBUG
    #define GG(x) assert(x)
#else
    #define GG(x) (x)
#endif
namespace mine
{
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}
    template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

    const int INF=0x3f3f3f3f;
    const int MOD=1e9+7;
    int mm(const int x){return x>=MOD?x-MOD:x;}
    template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
    ll qpower(ll x,ll e,int mod=MOD){ll ans=1;GG(e>=0);while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
    ll invm(ll x){return qpower(x,MOD-2);}
    const int N=1e5+10;

    pr a[N];bool cmp(pr x,pr y){return max(x.FR,x.SE)>max(y.FR,y.SE);}
    ll sum[N];
    void main()
	{
        int n=qread();fo(i,1,n) a[i].FR=qread(),a[i].SE=qread();sort(a+1,a+n+1,cmp);
        ll S=0;fo(i,1,n) S+=a[i].FR,a[i].FR=max(a[i].FR,a[i].SE),sum[i]=sum[i-1]+a[i].FR;
        ll ansx=0,ansy=1;
        fo(k,1,n)
        {
            int fl=0,fr=n,q=-1;
            while(fl<=fr)
            {
                int mid=(fl+fr)/2;
                if(sum[mid]-(k<=mid?a[k].FR:0)+a[k].SE>=S) q=mid,fr=mid-1; else fl=mid+1;
            }
            if(q<0) continue;
            if(sum[q]-(k<=q?a[k].FR:0)>=S) continue;//debug
            ll nowx=ll(n-(q-(k<=q)))*a[k].SE-S+sum[q]-(k<=q?a[k].FR:0),nowy=1ll*a[k].SE*n;
            ll d=gcd(nowx,nowy);nowx/=d,nowy/=d;
            if(1.0*nowx*ansy>1.0*ansx*nowy) ansx=nowx,ansy=nowy;//爆ll
        }
        write1(ansx),write(ansy);
	}
};//(ans+MOD)%MOD
signed main()
{
    srand(time(0));
    mine::main();
}
