#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
struct node
{
	int x,y;
}a[100010];
bool cmp(node a,node b){return max(a.x,a.y)<max(b.x,b.y);}
int n;
long long sum,s[100010];
inline int erfen(int pos)
{
	int l=1,r=n,p=0,d=max(a[pos].x,a[pos].y);
	while(l<=r)
	{
		int mid=l+r>>1;
		long long uf=s[mid];if(mid>=pos)uf-=d;
		if(uf<=sum)p=mid,l=mid+1;
		else r=mid-1;
	}return p;
}
inline long long gcd(long long x,long long y)
{
	if(x==0)return y;
	else return gcd(y%x,x);
}
int main()
{
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	n=read();
	for(int i=1;i<=n;i++)a[i].x=read(),a[i].y=read();
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		s[i]=s[i-1]+max(a[i].x,a[i].y);
		if(a[i].y>a[i].x)sum+=a[i].y-a[i].x;
	}
	long long ax=0,ay=1,x,y,ul;
	for(int i=1;i<=n;i++)
	{
		x=erfen(i);long long uf=sum-s[x];if(x>=i)x--,uf+=max(a[i].x,a[i].y);
		if(a[i].y>a[i].x)uf-=a[i].y-a[i].x;
		x=x*a[i].y+min(uf+a[i].y-a[i].x,1LL*a[i].y),y=1LL*n*a[i].y;ul=gcd(x,y);
		if(x<=0)continue;
		x/=ul,y/=ul;
		long long he=gcd(ay,y);
		if(1.0*ay/he*x>1.0*y/he*ax)ax=x,ay=y;
	}
	printf("%lld %lld\n",ax,ay);
	return 0;
}