#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;

priority_queue <pll> P, Q;
ll A[101010], B[101010], C[101010];
ll n, k, s, p, q;

ll gcd(ll a, ll b) { for(; b; swap(a, b)) a %= b; return a; }
void update(ll a, ll b) { if(p * b < a * q) p = a, q = b; }

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);

	ll i, x;

	cin >> n;

	for(i = 0; i < n; i ++){
		cin >> A[i] >> B[i];
		if(A[i] < B[i]){
			s += B[i] - A[i];
			P.emplace(-B[i], i);
			C[i] = 1;
		}
		else Q.emplace(-A[i], i);
	}

	for(k = 0; ; k ++){
		if(!P.empty() && (Q.empty() || P.top() > Q.top())){
			tie(x, i) = P.top();
			if(s + x < 0) break;
			P.pop();
		}
		else if(!Q.empty()){
			tie(x, i) = Q.top();
			if(s + x < 0) break;
			Q.pop();
		}
		else break;
		s += x; C[i] = 2;
	}

	p = 0; q = 1;

	for(i = 0; i < n; i ++){
		if(C[i] == 0){
			if(s + B[i] - A[i] >= 0){
				update(s + B[i] - A[i], B[i]);
			}
		}
		else if(C[i] == 1) update(s, B[i]);
		else{
			if(!P.empty() && (Q.empty() || P.top() > Q.top())){
				x = P.top().first;
			}
			else if(!Q.empty()){
				x = Q.top().first;
			}
			else x = -1e18;
			if(s + B[i] + x >= 0){
				update(s + B[i] + x, B[i]);
			}
		}
	}

	p += q * k; q *= n;
	x = gcd(p, q);
	p /= x; q /= x;

	cout << p << " " << q << "\n";

	return 0;
}