#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define vii vector < pii >
#define mp make_pair
#define db long double
#define pb push_back
#define int ll
#define all(s) s.begin(),s.end()
template < class P , class Q > ostream& operator<<(ostream& stream, pair < P , Q > v){ stream << "(" << v.fi << ',' << v.se << ")"; return stream;}
template < class T > ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream;}
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
const int N = 1e6 + 5;
pii s[N];
int32_t main(void) {
    int n;
    cin>>n;
    for (int i = 1;i <= n;++i)
    	cin>>s[i].fi>>s[i].se;
    vii A,B;
    ll offset = 0;
    for (int i = 1;i <= n;++i)
    	if (s[i].fi <= s[i].se)
    		B.pb(s[i]),offset += s[i].se - s[i].fi;
    	else
    		A.pb(s[i]);
   	if (B.empty())
   		return puts("0 1") * 0;
   	sort(all(A));
   	sort(all(B),[&](auto a,auto b) {
   			return a.se > b.se;
   		});
   	ll cur_sum = 0;
   	int sz = A.size();
   	int bst = -1;
   	for (int i = 0;i < sz;++i) {
   		cur_sum += A[i].fi;
   		if (cur_sum <= offset)
   			bst = i;
   	}
    while (A.size() > bst + 1)
   		A.pop_back();
   	cur_sum = 0;
   	for (int i = 0;i <= bst;++i)
   		cur_sum += A[i].fi;
	while (!B.empty() && cur_sum + B.back().fi <= offset + B.back().fi - B.back().se)
		cur_sum += B.back().fi,A.pb(B.back()),offset += B.back().fi - B.back().se,B.pop_back(),++bst,++sz;
	sort(all(A));
   	ll D = 0;
   	for (auto it : A)
   		D += it.fi;
   	for (auto it : B)
   		D += it.fi - it.se;
   	pair < ll , ll > Bst = mp(0ll,1ll);
   	for (auto it : B) {
   		ll X0 = 1ll * A.size() * it.se - D;
   		ll Y0 = 1ll * n * it.se;
   		if (Bst.fi * Y0 < Bst.se * X0)
   			Bst = mp(X0,Y0);
   	}
   	ll X = Bst.fi;
   	ll Y = Bst.se;
   	ll G = __gcd(X,Y);
   	X /= G;
   	Y /= G;
   	cout << X << ' ' << Y << '\n';
    return 0;
}