#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 998244353
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
struct PQ{
	priority_queue<ll>d;
	priority_queue<ll,vector<ll>,greater<ll>>u;
	ll ds,dn;
	PQ(void){
		ds=0,dn=0;
	}
	void psd(ll x){
		d.push(x);
		ds+=x;
		dn++;
	}
	ll ppd(void){
		ll res=d.top();
		ds-=res;
		dn--;
		d.pop();
		return res;
	}
	void psu(ll x){
		u.push(x);
	}
	ll ppu(void){
		ll res=u.top();
		u.pop();
		return res;
	}
};
ll gcd(ll x,ll y){
	if(x<y)swap(x,y);
	if(y==0)return 1;
	if(x%y==0)return y;
	return gcd(y,x%y);
}
ll n,s,ansx,ansy=1;
P x[100005];
PQ pq;
int main(void){
	cin>>n;
    for(int i=0;i<n;i++)cin>>x[i].S>>x[i].F;
    sort(x,x+n);
    for(int i=0;i<n;i++)s+=max(0LL,x[i].F-x[i].S);
    for(int i=0;i<n;i++){
		s-=max(0LL,x[i].F-x[i].S);
		while(!pq.u.empty()&&pq.ds+x[i].S+pq.u.top()<=s+x[i].F)pq.psd(pq.ppu());
		ll nx=0,ny=1;
		if(pq.ds+x[i].S<=s+x[i].F&&s<=pq.ds+x[i].S)ny=x[i].F,nx=pq.dn*ny+x[i].F-x[i].S+s-pq.ds;
		if(D(ansx)/D(ansy)<D(nx)/D(ny))ansx=nx,ansy=ny;
		pq.psd(x[i].S);
		pq.psu(pq.ppd());
	}
	ansy*=n;
	ll g=gcd(ansx,ansy);
	if(ansx==0)ansy=1;
	ansx/=g,ansy/=g;
	cout<<ansx<<' '<<ansy<<endl;
}
