#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define mp make_pair
#define pii pair<int,int>
#define fi first
#define se second
#define int long long

using namespace std;
typedef long long ll;
const int MAXN = 100005;
inline int readint()
{
	int res = 0, f = 1;
	char c = 0;
	while(!isdigit(c))
	{
		c = getchar();
		if(c=='-')
			f = -1;
	}
	while(isdigit(c))
		res = res*10+c-'0', c = getchar();
	return res*f;
}
int n;
pii s[MAXN],t[MAXN];
ll ansp = 1<<30, ansq = 1;
inline void getMin(ll x, ll y)
{
	if((__int128)x*ansq<(__int128)y*ansp)
		ansp = x, ansq = y; 
}
ll pre[MAXN],sum;
inline ll calc(int x, int mid)
{
	int val = max(s[x].fi,s[x].se);
	return t[mid].fi<=val?pre[mid]-val:pre[mid];
}
inline int binSearch(int x)
{
	int left = 1, right = n, res = -1, mid;
	while(left<=right)
	{
		mid = (left+right)>>1;
		if(calc(x,mid)>=sum-s[x].se)
			res = mid, right = mid-1;
		else
		    left = mid+1;
	}
	return res;
}
inline ll gcd(ll a, ll b)
    { return b?gcd(b,a%b):a; }

signed main()
{
	n = readint();
	for(int i = 1; i<=n; i++)
	{
		s[i].fi = readint(), s[i].se = readint();
		t[i].fi = max(s[i].fi,s[i].se), t[i].se = i;
		sum += s[i].fi;
	}
	sort(t+1,t+n+1), reverse(t+1,t+n+1);
	for(int i = 1; i<=n; i++)
		pre[i] = pre[i-1]+t[i].fi;
	for(int i = 1; i<=n; i++)
	{
		int res = binSearch(i);
		if(res<0)
			continue;
		ll val = sum-calc(i,res);
		if(t[res].fi<=max(s[i].fi,s[i].se))
			res--;
		if(val<0)
			continue;
		getMin(1ll*res*s[i].se+val,s[i].se);
	}
	ansq *= n, ansp = ansq-ansp;
	if(ansp<=0)
    {
		cout << 0 << " " << 1 << endl;
		return 0;
	}
	ll g = gcd(ansp,ansq);
	cout << ansp/g << " " << ansq/g << endl;
	return 0;
}
