#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
using namespace std;

long long N, A[1 << 18], B[1 << 18], Actual_B[1 << 18], S1[1 << 18], S2[1 << 18];
vector<tuple<long long, long long, long long>> E;

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

pair<int, int> solve(double pos) {
	int res = (int)(1.0 * pos);
	double amari = pos - 1.0 * res;

	// 微妙なやつを全探索
	double best = 1e18; int best_id = -1;
	for (int i = 0; i < N; i++) {
		long long A1 = S1[res];
		if (i < res) A1 = S1[res + 1] - A[i];
		long long A2 = S2[res + 1];
		if (i >= res + 1) A2 = S2[res] - (A[i] - B[i]);

		double alpha = 1.0 * A1 + 1.0 * A2;
		double beta = amari * A[i] + (1.0 - amari) * (A[i] - Actual_B[i]);
		if (best > alpha + beta) {
			best = alpha + beta;
			best_id = i;
			if (best < 0) {
				best += 0;
			}
		}
	}

	if (best <= 0) return make_pair(best_id, res);
	return make_pair(-1, -1);
}

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i] >> B[i]; Actual_B[i] = B[i]; if (A[i] > B[i]) B[i] = A[i];
		E.push_back(make_tuple(B[i], A[i], Actual_B[i]));
	}
	sort(E.begin(), E.end());
	for (int i = 0; i < N; i++) {
		B[i] = get<0>(E[i]);
		A[i] = get<1>(E[i]);
		Actual_B[i] = get<2>(E[i]);
	}
	for (int i = 1; i <= N; i++) S1[i] = S1[i - 1] + A[i - 1];
	for (int i = N - 1; i >= 0; i--) S2[i] = S2[i + 1] + (A[i] - B[i]);

	// 二分探索により境界を検出
	double cl = 0, cr = N, cm; pair<int, int> latest = make_pair(-1, -1);
	for (int i = 0; i < 77; i++) {
		cm = (cl + cr) / 2;
		pair<int, int> I = solve(cm);
		if (I.first >= 0) { cl = cm; latest = I; }
		else { cr = cm; }
	}

	if (latest == make_pair(-1, -1)) {
		cout << "0 1" << endl;
		return 0;
	}

	// 順番が決まったら？
	long long V1 = 0, cnts = 0;
	for (int i = 0; i < N; i++) {
		if (i == latest.first) continue;
		if (cnts < latest.second) V1 += A[i];
		else V1 += (A[i] - B[i]);
		cnts++;
	}
	V1 += (A[latest.first] - Actual_B[latest.first]);

	long long Katamuki = Actual_B[latest.first];
	long long Ans1 = 1LL * latest.second * Katamuki - V1;
	long long Ans2 = N * Katamuki;
	long long GCD = gcd(Ans1, Ans2);

	cout << Ans1 / GCD << " " << Ans2 / GCD << endl;
	return 0;
}