#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?x-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
using namespace std;
const int N=100005;
int n,k;
pll a[N];
ll As,Bs;
ll gcd(ll x,ll y){
	return y?gcd(y,x%y):x;
}
int main(){
	scanf("%d",&n);
	For(i,1,n){
		int x,y;
		scanf("%d%d",&x,&y);
		a[i]=pll(max(x,y),y);
		As+=x;
	}
	sort(a+1,a+n+1,greater<pll>());
	k=Bs=0;
	for (;k<=n;++k){
		Bs+=a[k].fi;
		if (Bs>=As) break;
	}
	//printf("%lld %lld\n",As,Bs);
	if (Bs<As)
		return puts("0 1\n"),0;
	ll fm=1,fz=1;
	For(i,1,n){
		ll val=As-Bs+a[min(i,k)].fi;
		if (val<=a[i].se)
			if (val*fm<fz*a[i].se)
				fm=a[i].se,fz=val;
	}
	//printf("%lld %lld\n",fm,fz);
	fz=(fm-fz)+(n-k)*fm; fm*=n;
	ll G=gcd(fz,fm); fz/=G; fm/=G;
	printf("%lld %lld\n",fz,fm);
}
/*
所有选的y越大越在后
x<y一定会选
剩下选若干
*/