#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
int n;
typedef long long ll;
struct road{
	int a,b;
	int sum()const{
		return a-min(a-b,0);
	}
	int _pref()const{
		return min(a-b,0);
	}
	bool operator < (const road B)const{
		return a-min(a-b,0) < B.a-min(B.a-B.b,0);
	}
}s[N];
ll pref[N];
ll basic;

inline ll cal(int x,int y){
	ll ret =0;
	if(y>x)++y, ret-=s[x].sum();
	ret += pref[y];
	return ret;
}

struct Numb{
	int integer;
	ll d1,d2;
	bool operator < (const Numb b){
		return integer==b.integer?(long double)d1*b.d2 < (long double)b.d1*d2:integer<b.integer;
	}
};

void print(Numb x){
	ll d1=x.d1+x.d2*x.integer;
	ll d2=x.d2*n;
	ll g=__gcd(d1,d2);
	printf("%lld %lld\n",d1/g,d2/g);
}

int main()
{
	cin >> n;
	for(int i=1;i<=n;i++){
		scanf("%d%d",&s[i].a,&s[i].b);
		basic += s[i]._pref();
	}
	basic = -basic;
	sort(s+1,s+n+1);
	Numb res = (Numb){0,0,1};
	for(int i=1;i<=n;i++)pref[i] = pref[i-1] + s[i].sum();
	for(int i=1;i<=n;i++)if(s[i]._pref()<0){
		int l=0,r=n-1;
		while(l<r){
			int mid = (l+r+1)>>1;
			if(cal(i,mid)<=basic)l=mid;
			else r=mid-1;
		}
		ll _d = basic - cal(i,l);
		// cout << s[i].a << " " << s[i].b << " " << l << endl;
		Numb cur = (Numb){l,_d,s[i].b};
		if(res < cur) res=cur;
	}
	print(res);
}