#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int N=100050;
int a[N],b[N],c[N],n,id[N];
struct Frac
{
	ll p,q;
	Frac(){}
	Frac(ll a, ll b){ p=a,q=b;}
	Frac operator + (Frac b){ return Frac(q*b.p+p*b.q,q*b.q);}
	bool operator < (Frac b){ return p*b.q<b.p*q;}
} ans[N];
int rev[N];
int main()
{
	scanf("%i",&n);
	ll sum=0;
	for(int i=1;i<=n;i++) scanf("%i %i",&a[i],&b[i]),c[i]=max(b[i],a[i]),sum+=a[i],id[i]=i;
	sort(id+1,id+1+n,[&](int i, int j){ return c[i]>c[j];});
	for(int i=1;i<=n;i++) rev[id[i]]=i;
	int ptr=0;
	while(ptr<n && sum-c[id[ptr+1]]>0) ptr++,sum-=c[id[ptr]];
	if(ptr==n) return 0*printf("0 1\n");
	ll lo=0,hi=0;
	for(int i=1;i<=ptr;i++) lo+=c[id[i]];
	hi=lo;
	hi+=c[id[ptr+1]];
	Frac best;
	//printf("ptr:%i\n",ptr);
	sum=0;
	for(int i=1;i<=n;i++) sum+=a[i];
	for(int i=1;i<=n;i++)
	{
		int B=b[i];
		ll tmp;
		if(rev[i]<=ptr) tmp=hi-c[id[i]];
		else tmp=lo;
		ll ost=sum-tmp;
		//printf("%i %lld\n",i,ost);
		ans[i]=Frac(ost,b[i]);
		if(i==1 || ans[i]<best) best=ans[i];
	}
	best.q*=n;
	Frac add(ptr,n);
	Frac out=best+add;
	out.p=out.q-out.p;
	ll g=__gcd(out.p,out.q);
	out.p/=g;
	out.q/=g;
	printf("%lld %lld\n",out.p,out.q);
	return 0;
}


/*#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int N=100050;
int a[N],b[N],n;
int Find()
{
	int top=n,bot=1,ans=0,mid;
	while(top>=bot)
	{
		mid=top+bot>>1;
		ll sum=0;
		for(int i=1;i<=n-mid;i++) sum+=a[i];
		ll mn=sum;
		for(int i=1;i<=mid;i++)
		{
			sum+=a[n-mid+i];
			sum-=b[i];
			mn=min(mn,sum);
		}
		if(mn<=0) top=mid-1;
		else ans=mid,bot=mid+1;
	}
	return ans;
}
ll L[N],G[N],R[N];
struct Frac
{
	ll p,q;
	Frac(){}
	Frac(ll a, ll b){ p=a,q=b;}
	Frac operator + (Frac b){ return Frac(q*b.p+p*b.q,q*b.q);}
	bool operator < (Frac b){ return p*b.q<b.p*q;}
} ans[N];
int main()
{
	scanf("%i",&n);
	for(int i=1;i<=n;i++) scanf("%i %i",&a[i],&b[i]);
	sort(a+1,a+1+n);
	sort(b+1,b+1+n);
	reverse(b+1,b+1+n);
	int sz=Find();
	if(sz==n) return 0*printf("0 1\n");
	ll p=sz,q=n;
	Frac add(p,q);

	ll sum=0;
	for(int i=1;i<=n-sz;i++) sum+=a[i];
	ll tmp=0;L[0]=0;
	for(int i=1;i<=sz;i++)
	{
		tmp=tmp+a[n-sz+i]-b[i];
		G[i]=tmp;
		L[i]=min(L[i-1],tmp);
	}
	for(int i=sz;i>=1;i--)
	{
		R[i]=min(R[i+1]+a[n-sz+i]-b[i+1],(ll)a[n-sz+i]-b[i+1]);
	}

	Frac best;
	for(int i=1;i<=sz+1;i++)
	{
		int mn=min(sum+L[i-1],sum+G[i-1]+R[i]);
		ans[i]=Frac(mn,(ll)b[i]);
		if(i==1 || best<ans[i]) best=ans[i];
	}
	Frac out=best+add;
	ll g=__gcd(out.p,out.q);
	out.p/=g;
	out.q/=g;
	printf("%lld %lld\n",p,q);
	return 0;
}*/