#include<bits/stdc++.h>
#define llong long long
#define mkpr make_pair
#define x first
#define y second
#define iter iterator
#define riter reversed_iterator
#define y1 Lorem_ipsum_
#define tm dolor_sit_amet_
using namespace std;

inline int read()
{
	int x = 0,f = 1; char ch = getchar();
	for(;!isdigit(ch);ch=getchar()) {if(ch=='-') f = -1;}
	for(; isdigit(ch);ch=getchar()) {x = x*10+ch-48;}
	return x*f;
}

const int mxN = 1e5;
struct Element
{
	llong a,b;
	bool operator <(const Element &arg) const {return max(a,b)>max(arg.a,arg.b);}
} a[mxN+3];
llong s[mxN+3];
int n; llong sum;

struct Fraction
{
	llong a,b,c;
	Fraction() {}
	Fraction(llong _a,llong _b,llong _c) {a = _a,b = _b,c = _c;}
	bool operator <(const Fraction &arg) const
	{
		if(a!=arg.a) {return a<arg.a;}
		return b*arg.c<arg.b*c;
	}
};

llong gcd(llong x,llong y) {return y==0?x:gcd(y,x%y);}

int main()
{
	n = read();
	for(int i=1; i<=n; i++) scanf("%lld%lld",&a[i].a,&a[i].b),sum += a[i].a;
	sort(a+1,a+n+1);
	for(int i=1; i<=n; i++) s[i] = s[i-1]+max(a[i].a,a[i].b);
	Fraction ans(n,0,1);
	for(int i=1; i<=n; i++)
	{
		int pos = lower_bound(s+1,s+n+1,sum-a[i].b)-s,cnt = pos; llong rst = sum-s[pos];
		if(pos>=i) {pos = lower_bound(s+1,s+n+1,sum-a[i].b+max(a[i].a,a[i].b))-s,cnt = pos-1,rst = sum-s[pos]+max(a[i].a,a[i].b);}
		if(pos>n) {continue;}
		rst = max(0ll,rst);
		Fraction tmp(cnt,rst,a[i].b);
		if(tmp<ans) {ans = tmp;}
	}
	llong x = ans.c*ans.a+ans.b,y = ans.c*n; x = y-x;
	llong g = gcd(x,y); x/=g,y/=g;
	printf("%lld %lld\n",x,y);
	return 0;
}