#include <bits/stdc++.h>
using namespace std;
using lint = long long;

using pi = pair<int, int>;
using frac = pair<lint, lint>;
const int MAXN = 100005;

int n;
pi a[MAXN];
lint sum[MAXN];

bool cmp(frac a, frac b){
	return (__int128)a.first * b.second < (__int128)b.first * a.second;
}

lint gcd(lint x, lint y){ return y ? gcd(y, x%y) : x; }

int main(){
	scanf("%d",&n);
	for(int i=0; i<n; i++) scanf("%d %d",&a[i].first,&a[i].second);
	sort(a, a + n, [&](const pi &p, const pi &q){
		return max(p.first, p.second) > max(q.first, q.second);
	});
	frac dap(n, 1);
	auto upd_val = [&](lint n, lint a, lint b){
	//	assert(a <= b);
		a += n * b;
		dap = min(dap, frac(a, b), cmp);
	};
	lint sumA = 0;
	for(int i=1; i<=n; i++){
		sumA += a[i-1].first;
		sum[i] = sum[i-1] + max(a[i-1].first, a[i-1].second);
	}
	for(int i=0; i<n; i++){
		if(sum[i] >= sumA - a[i].second){
			auto lb = lower_bound(sum, sum + i + 1, sumA - a[i].second) - sum;
			lint tmp = sumA - sum[lb];
			if(tmp <= 0){
				upd_val(lb, 0, 1);
			}
			else{
				upd_val(lb, tmp, a[i].second);
			}
		}
		else{
			lint newval = sumA + max(a[i].first, a[i].second);
			auto lb = lower_bound(sum + i + 1, sum + n + 1, newval - a[i].second) - sum;
			lint tmp = newval - sum[lb];
			if(tmp <= 0) upd_val(lb - 1, 0, 1);
			else{
				if(tmp <= a[i].second) upd_val(lb - 1, tmp, a[i].second);
			}
		}
	}
	dap.first = (n * dap.second - dap.first);
	dap.second *= n;
	
	{
		lint g = gcd(dap.first, dap.second);
		dap.first /= g; dap.second /= g;
	}
	printf("%lld %lld\n", dap.first, dap.second);
}
