#include<bits/stdc++.h>
#define ld double
#define ull unsigned long long
#define ll long long
#define pii pair<int, int>
#define iiii pair<int, pii>
#define mp make_pair
#define INF 1000000000
#define MOD 1000000007
#define rep(i, x) for(int (i) = 0; (i) < (x); (i)++)
inline int getint() {
	int x = 0, p = 1; char c = getchar();
	while (c <= 32) c = getchar();
	if (c == 45) p = -p, c = getchar();
	while (c > 32) x = x * 10 + c - 48, c = getchar();
	return x * p;
}
using namespace std;
//ruogu_alter
int n;
ll s;
vector<pii>v;
//
ll gcd(ll x, ll y) {
	if(!y) return x;
	return gcd(y, x % y);
}
inline void upd(pair<ll, ll> &u, ll x, ll y) {
	if(u.first * y > x * u.second) {
		u.first = x;
		u.second = y;
	}
}
int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	n = getint();
	rep(i, n) {
		int x = getint(), y = getint();
		s += x;
		v.emplace_back(mp(max(x, y), y));
	}
	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());
	int k = 0; ll sum = 0;
	rep(i, n) {
		sum += v[k++].first;
		if (sum >= s) break;
	}
	pair<ll, ll>px = mp(1, 1);
	rep(i, n) {
		int x = s - (sum - v[min(i, k - 1)].first);
		if(x <= v[i].second) upd(px, x, v[i].second);
	}
	px.first = px.second * (n - k + 1) - px.first;
	px.second *= n;
	ll g = gcd(px.first, px.second);
	px.first /= g; px.second /= g;
	cout << px.first << " " << px.second << endl;
	return 0;
}
