#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

llint n;
llint a[100005], b[100005];
P p[100005];
llint pos[100005], sum[100005], S;

llint gcd(llint a, llint b)
{
	if(b == 0) return a;
	return gcd(b, a%b);
}

P getmax(P p, P q)
{
	if(p.first/p.second < q.first/q.second) return q;
	if(p.first/p.second > q.first/q.second) return p;
	
	llint P = p.first % p.second, Q = q.first % q.second;
	if(P*q.second <= Q*p.second) return q;
	else return p;
}

P reduce(P p)
{
	if(p.first == 0) return P(0, 1);
	llint g = gcd(p.first, p.second);
	p.first /= g, p.second /= g;
	return p;
}

P calc(llint i)
{
	llint ub = n, lb = -1, mid;
	while(ub-lb>1){
		mid = (ub+lb)/2;
		llint tmp = sum[mid];
		if(i <= mid) tmp -= p[i].first;
		if(tmp >= S-b[p[i].second]) ub = mid;
		else lb = mid;
	}
	
	llint tmp = sum[ub];
	if(i <= ub) tmp -= p[i].first, ub--;
	if(tmp >= S) return P(0, 1);
	
	llint x = n-ub, y = S-tmp;
	P ret = reduce(P(max(0LL, b[p[i].second]*x-y), b[p[i].second]));
	return ret;
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a[i] >> b[i];
		p[i] = P(max(a[i], b[i]), i);
	}
	sort(p+1, p+n+1);
	reverse(p+1, p+n+1);
	
	for(int i = 1; i <= n; i++){
		sum[i] = sum[i-1] + p[i].first;
		S += a[i];
	}
	
	P ans = P(0, 1);
	for(int i = 1; i <= n; i++) ans = getmax(ans, calc(i));
	ans.second *= n;
	ans = reduce(ans);
	cout << ans.first << " " << ans.second << endl;
	
	return 0;
}