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

#define ll long long
#define ld long double

template <typename T>
boolean vmax(T& a, T b) {
	return (a < b) ? (a = b, true) : (false);
}

const int N = 1e5 + 5;
const ll llf = 1e17;
const int inf = (signed) (~0u >> 2);

ll gcd(ll a, ll b) {
	return (b) ? (gcd(b, a % b)) : (a);
}

typedef class Fraction {
	public:
		ll a, b;

		Fraction() : a(0), b(1) {	}
		Fraction(ll a, ll b) : a(a), b(b) {	}

		boolean operator < (Fraction B) const {
			return ((ld) a) * B.b - ((ld) b) * B.a < 0;
		}
		boolean operator > (Fraction B) const {
			return ((ld) a) * B.b - ((ld) b) * B.a > 0;
		}
} Fraction;

#define pii pair<int, int>

typedef class Item {
	public:
		int a, b, id;

		Item() {	}
		Item(int a, int b, int id) : a(a), b(b), id(id) {	}

		int maxval() const {
			return max(a, b);
		}
		boolean operator < (Item i) const {
			return maxval() < i.maxval();
		}
} Item;

int n;
vector<Item> E;
ll _presum[N], *presum;

int main() {
	scanf("%d", &n);
	ll _sum = 0;
	for (int i = 1, a, b; i <= n; i++) {
		scanf("%d%d", &a, &b);
		E.emplace_back(a, b, i);
		_sum += max(b - a, 0);
	}
	sort(E.begin(), E.end());
	Fraction ans (0, 1), I (1, 1);
	presum = _presum + 1;
	presum[-1] = 0;
	for (int i = 0; i < n; i++)
		presum[i] = presum[i - 1] + E[i].maxval();
	for (int j = 0; j < n; j++) {
		ll sum = _sum, ts;
		Item& e = E[j];
		if (e.a > e.b)
			sum += e.b - e.a;
		int l = 0, r = n - 1, mid;
#define calc(p) (presum[p] - (p >= j) * e.maxval())
		while (l <= r) {
			mid = (l + r) >> 1;
			ts = calc(mid);
			if (ts <= sum) {
				l = mid + 1;
			} else {
				r = mid - 1;
			}
		}
		Fraction tmp (sum - calc(l - 1), e.b);
		tmp = min(tmp, I);
		tmp.a += tmp.b * (l - (l > j));
		ans = max(ans, tmp);
	}
	ll g = gcd(ans.a, ans.b *= n);
	ans.a /= g;
	ans.b /= g;
	printf("%lld %lld\n", ans.a, ans.b);
	return 0;
}
