#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
ll gcd(ll a, ll b){
	if(b==0) return a;
	return gcd(b, a%b);
}
int main()
{
	int n;
	cin>>n;
	vector<P> v1, v2;
	for(int i=0; i<n; i++){
		ll a, b;
		cin>>a>>b;
		if(b>=a) v1.push_back({b, a});
		else v2.push_back({a, b});
	}
	sort(v1.begin(), v1.end());
	sort(v2.begin(), v2.end());
	int n1=v1.size(), n2=v2.size();
	vector<ll> sc1(n1+1), sa1(n1+1), sa2(n2+1), mnb2(n2+1), mxb2(n2+1);
	mnb2[0]=1e9+7, mxb2[0]=0;
	for(int i=0; i<n2; i++) mnb2[i+1]=min(mnb2[i], v2[i].second), mxb2[i+1]=max(mxb2[i], v2[i].second);
	for(int i=0; i<n1; i++){
		sc1[i+1]=sc1[i]+v1[i].first-v1[i].second;
		sa1[i+1]=sa1[i]+v1[i].second;
	}
	for(int i=0; i<n2; i++) sa2[i+1]=sa2[i]+v2[i].first;
	auto check=[&](int m){
		for(int i=0; i<=min(m, n2); i++){
			if(m-i>n1) continue;
			ll s=-sa2[i]-sa1[m-i]+sc1[n1]-sc1[m-i];
			if(s>=0) return true;
		}
		return false;
	};
	int l=0, r=n;
	while(r-l>1){
		int mid=(l+r)/2;
		if(check(mid)) l=mid;
		else r=mid;
	}
	vector<ll> mxs(n2+2);
	mxs[0]=-1;
	using lll=__int128_t;
	P ans=P(0, 1);
	for(int i=0; i<=min(l, n2); i++){
		ll s=-1;
		if(l-i<n1) s=-sa2[i]-sa1[l-i]+sc1[n1]-sc1[l-i];
		mxs[i+1]=max(mxs[i], s);
		if(s<0) continue;
		if((lll)ans.first*v1[l-i].first<=(lll)s*ans.second) ans=P(s, v1[l-i].first);
	}
	for(int i=min(l, n2)+1; i<=n2; i++) mxs[i+1]=mxs[i];
	for(int i=0; i<n2; i++){
		ll s=mxs[i+1]+v2[i].second-v2[i].first;
		if(s<0) continue;
		if((lll)ans.first*v2[i].second<=(lll)s*ans.second) ans=P(s, v2[i].second);
	}
	for(int i=1; i<=n2 && i-1<=l; i++){
		ll s=-1;
		bool neg=0;
		if(l-i+1<=n1){
			if(-sa2[i]-sa1[l-i+1]+sc1[n1]-sc1[l-i+1]>=0) s=-sa2[i]-sa1[l-i+1]+sc1[n1]-sc1[l-i+1]+mnb2[i];
			else neg=1, s=-sa2[i]-sa1[l-i+1]+sc1[n1]-sc1[l-i+1]+mxb2[i];
		}
		if(s<0) continue;
		if(neg){
			if((lll)ans.first*mxb2[i]<=(lll)s*ans.second) ans=P(s, mxb2[i]);
		}else{
			if((lll)ans.first*mnb2[i]<=(lll)s*ans.second) ans=P(s, mnb2[i]);
		}
	}
	for(int i=0; i<=min(l, n2); i++){
		ll s=-1;
		bool neg=0;
		if(l-i+1<=n1){
			if(-sa2[i]-sa1[l-i+1]+sc1[n1]-sc1[l-i+1]>=0) s=-sa2[i]-sa1[l-i+1]+sc1[n1]-sc1[l-i+1]+v1[0].first;
			else neg=1, s=-sa2[i]-sa1[l-i+1]+sc1[n1]-sc1[l-i+1]+v1[l-i].first;
		}
		if(s<0) continue;
		if(neg){
			if((lll)ans.first*v1[l-i].first<=(lll)s*ans.second) ans=P(s, v1[l-i].first);
		}else{
			if((lll)ans.first*v1[0].first<=(lll)s*ans.second) ans=P(s, v1[0].first);
		}
	}
	ans=P(ans.first+l*ans.second, ans.second*n);
	ll g=gcd(ans.first, ans.second);
	cout<<ans.first/g<<" "<<ans.second/g<<endl;
	return 0;
}
