//minamoto
#include<bits/stdc++.h>
#define R register
#define fi first
#define se second
#define LL __int128
#define double long double
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
typedef long long ll;
const int N=1e5+5;
ll sa[N],sb[N],sum,x,y,tx,ty,g;int a[N],b[N],id[N],n;
priority_queue<int>q;
inline bool ck(R ll x,R ll y,R ll xx,R ll yy){return (LL)x*yy>=(LL)xx*y;}
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d",&n);
	fp(i,1,n)scanf("%d%d",&a[i],&b[i]),id[i]=i;
	sort(id+1,id+1+n,[](const int &x,const int &y){return b[x]-a[x]>b[y]-a[y];});
	R int pos=0;while(pos<n&&a[id[pos+1]]<=b[id[pos+1]])++pos;
//	if(!pos)return puts("0 1"),0;
	sort(id+1,id+1+pos,[](const int &x,const int &y){return b[x]<b[y];});
	sort(id+pos+1,id+n+1,[](const int &x,const int &y){return a[x]==a[y]?b[x]>b[y]:a[x]<a[y];});
	fp(i,1,pos)sa[i]=sa[i-1]+a[id[i]],sb[i]=sb[i-1]+b[id[i]];
	fp(i,1,pos)q.push(b[id[i]]);
	double res=0,las=0;R int cnt=pos,tp=0;
	sum=sa[pos],x=0,y=1;
	fp(i,pos+1,n+1){
		while(!q.empty()&&sum>=0)sum-=(tp=q.top()),q.pop(),--cnt;
		if(sum>=0)break;
		tx=sum+tp;
		tx=tp-tx,ty=tp;
		tx+=cnt*ty,ty*=n;
		g=__gcd(tx,ty),tx/=g,ty/=g;
		if(ck(tx,ty,x,y))x=tx,y=ty;
		sum+=a[id[i]],++cnt,q.push(b[id[i]]);
	}
	printf("%lld %lld\n",x,y);
	return 0;
}