#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>

struct node { ll x,y; }a[100010];

int n;

inline int rd()
{
	int x=0;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

inline ll gcd(ll x,ll y) { return (!y)?x:gcd(y,x%y); }

inline bool cmp(const node &x,const node &y) { return max(x.x,x.y)>max(y.x,y.y); }

inline pll check(pll x,pll y) { return (x.first*y.second>x.second*y.first)?x:y; }

int main()
{
	n=rd();
	for (int i=1;i<=n;i++) a[i].x=rd(),a[i].y=rd();
	ll sum=0;
	for (int i=1;i<=n;i++) sum+=a[i].x;
	sort(a+1,a+n+1,cmp);
	int id=0;ll s=0;
	for (int i=1;i<=n;i++)
	{
		if (s+max(a[i].x,a[i].y)>sum) break;
		s+=max(a[i].x,a[i].y);id=i;
	}
	if (id==n) { puts("0 1");return 0; }
	pll ans(0,1);
	for (int i=1;i<=n;i++)
	{
		if (i>id)
		{
			if (s+a[i].y>=sum) ans=check(ans,pll(a[i].y-sum+s,a[i].y));
		}
		else
		{
			ll now=s-max(a[i].x,a[i].y)+max(a[id+1].x,a[id+1].y);
			if (now+a[i].y>=sum) ans=check(ans,pll(a[i].y-sum+now,a[i].y));
		}
	}
	ans.first+=ans.second*(n-id-1);ans.second*=n;
	ll hh=gcd(ans.first,ans.second);
	printf("%lld %lld\n",ans.first/hh,ans.second/hh);
	return 0;
}