#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
const int MAXN = 100000;
ll gcd(ll a, ll b) {
	return b == 0 ? a : gcd(b, a % b);
}
void get(ll &a, ll &b) {
	ll d = gcd(a, b);
	a /= d, b /= d;
}
ll ans1, ans2;
void update(ll a, ll b) {
	get(a, b);
	if( 1.0*ans1/ans2 < 1.0*a/b )
		ans1 = a, ans2 = b;
}
struct node{
	int A, B, C;
	friend bool operator < (node a, node b) {
		return a.C < b.C;
	}
}a[MAXN + 5];
ll sum[MAXN + 5], SA;
int main() {
	int N; scanf("%d", &N);
	for(int i=1;i<=N;i++)
		scanf("%d%d", &a[i].A, &a[i].B), a[i].C = max(a[i].A, a[i].B);
	sort(a + 1, a + N + 1);
	for(int i=N;i>=1;i--)
		sum[i] = sum[i + 1] + a[i].C, SA += a[i].A;
	ans1 = 0, ans2 = 1;
	for(int i=1;i<=N;i++) {
		if( SA - (sum[1] - a[i].C) > a[i].B )
			continue;
		int le = 1, ri = N + 1;
		while( le < ri ) {
			int mid = (le + ri + 1) >> 1;
			if( mid <= i ) {
				if( SA - (sum[mid] - a[i].C) <= a[i].B ) le = mid;
				else ri = mid - 1;
			}
			else {
				if( SA - sum[mid] <= a[i].B ) le = mid;
				else ri = mid - 1;
			}
		}
		if( le <= i ) {
			if( SA - (sum[le] - a[i].C) <= a[i].B && SA - (sum[le] - a[i].C) >= 0 )
				update(1LL*le*a[i].B - (SA - (sum[le] - a[i].C)), 1LL*N*a[i].B);
		}
		else  {
			if( SA - sum[le] <= a[i].B && SA - sum[le] >= 0 )
				update(1LL*(le-1)*a[i].B - (SA - sum[le]), 1LL*N*a[i].B);
		}
	}
	printf("%lld %lld\n", ans1, ans2);
}