#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[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;
}