#include<cstdio>
#include<iostream>
#include<algorithm>
#define RI register int
#define CI const int&
#define int long long
using namespace std;
const int N=100005;
struct frac
{
	int x,y;
	inline frac(CI X=0,CI Y=0)
	{
		x=X; y=Y;
	}
	friend inline bool operator < (const frac& A,const frac& B)
	{
		return 1.0*A.x*B.y<1.0*A.y*B.x;
	}
	friend inline bool operator > (const frac& A,const frac& B)
	{
		return 1.0*A.x*B.y>1.0*A.y*B.x;
	}
}ans(0,1);
struct data
{
	int a,b,val;
	friend inline bool operator < (const data& A,const data& B)
	{
		return A.val<B.val;
	}
}p[N]; int pfx[N],n,sum;
inline int gcd(CI x,CI y)
{
	return y?gcd(y,x%y):x;
}
signed main()
{
	//freopen("CODE.in","r",stdin); freopen("CODE.out","w",stdout);
	RI i; for (scanf("%lld",&n),i=1;i<=n;++i)
	scanf("%lld%lld",&p[i].a,&p[i].b),
	p[i].val=max(p[i].a,p[i].b),sum+=max(p[i].b-p[i].a,0LL);
	for (sort(p+1,p+n+1),i=1;i<=n;++i) pfx[i]=pfx[i-1]+p[i].val;
	#define calc(x) (pfx[x]-((x)>=i?p[i].val:0))
	for (i=1;i<=n;++i)
	{
		int cur=sum; if (p[i].a>p[i].b) cur+=p[i].b-p[i].a;
		int l=1,r=n,mid; while (l<=r)
		if (calc(mid=l+r>>1)<=cur) l=mid+1; else r=mid-1;
		//printf("%lld %lld\n",p[i].a,p[i].b);
		frac ret(cur-calc(l-1),p[i].b);	ret=min(ret,frac(1,1));
		ret.x+=ret.y*(l-1-(l>i)); ans=max(ans,ret);
	}
	#undef calc
	int g=gcd(ans.x,ans.y*=n); return printf("%lld %lld",ans.x/g,ans.y/g),0;
}