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

typedef long long ll;
const int N = 100010;
struct Node {
	int x, y, mx;
} w[N];

inline bool cmp(Node a, Node b)
{
	return a.mx > b.mx;
}

int main()
{
	register int n;
	scanf("%d", &n);
	register ll sum = 0;
	for (register int i = 1; i <= n; ++i) {
		scanf("%d %d", &w[i].x, &w[i].y);
		sum += w[i].x;
		w[i].mx = max(w[i].x, w[i].y);
	}
	sort(w + 1, w + n + 1, cmp);
	register int cnt = 0;
	register ll now = 0;
	while (cnt <= n) {
		now += w[++cnt].mx;
		if (now >= sum) break;
	}
	register ll ansx = 1, ansy = 1;
	for (register int i = 1; i <= cnt; ++i) {
		register ll tmp = sum - now + w[i].mx;
		if (tmp <= w[i].y && tmp * ansy < ansx * w[i].y) ansx = tmp, ansy = w[i].y;
	}
	register ll tmp = sum - now + w[cnt].mx;
	for (register int i = cnt + 1; i <= cnt; ++i) {
		if (tmp <= w[i].y && tmp * ansy < ansx * w[i].y) ansx = tmp, ansy = w[i].y;
	}
	ansx = ansy - ansx + ansy * (n - cnt);
	ansy *= n;
	register ll gcd = __gcd(ansx, ansy);
	ansx /= gcd, ansy /= gcd;
	printf("%lld %lld\n", ansx, ansy);
	return 0;
}