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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define fill(a)  memset(a, 0, sizeof (a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

void pre(){


}

void solve(){


}
int a[100009],b[100009];
int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	pre();
	int n;cin>>n;
	vector<pii> v;
	ll s=0;
	rep(i,n) cin>>a[i]>>b[i],v.pb({a[i]+max(0,b[i]-a[i]),i}),s+=max(0,b[i]-a[i]);
	sort(all(v));
	reverse(all(v));
	int x=0;
	ll r=0;
	while(x<n&&(r+v.back().fst<=s)){
			x++;
			r+=a[v.back().snd];
			s-=max(0,b[v.back().snd]-a[v.back().snd]);
			v.pop_back();
	}
	ll g1=x,g2=n;
	if(x<n){
		ld ans = 1.0*g1/g2;
		trav(j,v){
			if(b[j.snd]>=a[j.snd]){
				ll gg1 = (s-r)+1ll*x*j.fst;
				ll gg2=1ll*n*j.fst;
				if(1.0*gg1/gg2>ans) {
					g1=gg1,g2=gg2;
					ans=1.0*gg1/gg2;
				}
			}
			else{
				ll gg1 = (s-r-a[j.snd]+b[j.snd])+1ll*x*b[j.snd];
				ll gg2=1ll*n*b[j.snd];
				if(1.0*gg1/gg2>ans) {
					g1=gg1,g2=gg2;
					ans=1.0*gg1/gg2;
				}
			}
		}
	}
	ll g = __gcd(g1,g2);
	g1/=g,g2/=g;
	cout<<g1<<' '<<g2;
	return 0;
}

