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

typedef long long LL;
LL A[100005];
LL B[100005];
typedef pair<LL, LL> pLL;
int main(){
	int n; cin >> n;
	for (int i = 0; i < n; i++){
		cin >> A[i] >> B[i];
	}
	vector<pLL> v;
	for (int i = 0; i < n; i++){
		v.push_back(make_pair(B[i], A[i]));
	}
	sort(v.begin(), v.end());
	//find what's the most we can do. 
	//how many numbers can you fit in between? 
	int lo = 0;
	int hi = n - 1;
	while (lo != hi){
		int mid = (lo + hi + 1) / 2;
		vector<LL> sum_lowest(n + 2);
		vector<LL> suffix(n + 2);
		multiset<int> m;
		LL sm = 0;
		for (int i = 0; i < mid; i++){
			m.insert(v[i].second);
			sm += v[i].second;
		}
		sum_lowest[mid] = sm; 
		for (int i = mid; i < n; i++){
			m.insert(v[i].second);
			sm += v[i].second;
			auto it = m.end();
			it--;
			sm -= *(it);
			m.erase(it);
			sum_lowest[i + 1] = sm;
		}
		LL cur = 0;
		for (int i = n - 1; i >= 0; i--){
			cur += max(v[i].first - v[i].second, 0LL);
			suffix[i + 1] = cur;
		}
		bool works = false;
		for (int i = mid; i < n; i++){
			if (suffix[i + 1] >= sum_lowest[i]){
				works = true;
			}
		}
		if (works){
			lo = mid;
		}
		else{
			hi = mid - 1; 
		}
	}
	LL max_frac_n = 0;
	LL max_frac_d = 1;
	multiset<LL> m;
	vector<LL> sum_lowest(n + 2);
	vector<LL> suffix(n + 2); 
	LL sm = 0;
	for (int i = 0; i < lo; i++){
		m.insert(v[i].second);
		sm += v[i].second;
	}
	sum_lowest[lo] = sm;
	for (int i = lo; i < n; i++){
		m.insert(v[i].second);
		sm += v[i].second;
		auto it = m.end();
		it--;
		sm -= *(it);
		m.erase(it);
		sum_lowest[i + 1] = sm;
	}
	LL cur = 0;
	for (int i = n - 1; i >= 0; i--){
		cur += max(v[i].first - v[i].second, 0LL);
		suffix[i + 1] = cur;
	}	
	for (int i = lo; i < n; i++){
		LL tmp_num = suffix[i + 2] + v[i].first - v[i].second - sum_lowest[i];
		LL tmp_denom = v[i].first;
		if (tmp_num * max_frac_d > max_frac_n * tmp_denom){
			max_frac_n = tmp_num;
			max_frac_d = tmp_denom;
		}
	}
	LL fin_num = (max_frac_d) * lo + max_frac_n;
	LL fin_denom = max_frac_d * n;
	LL g = __gcd(fin_num, fin_denom);
	cout << fin_num / g << ' ' << fin_denom / g << endl;
}
