#include<bits/stdc++.h>

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll gcd(ll a,ll b){
    if(b==0)
        return a;
    return gcd(b, a % b);
}

ll N;
ll A[101010], B[101010],As;
pll BA[101010];
pll abv[101010];
ll mk[101010],Sm[101010];
pll ans;
ll i, j, k;

bool comp(pll a){
    if(ans.first/ans.second<a.first/a.second){
        return true;
    }
    if(ans.first/ans.second>a.first/a.second){
        return false;
    }
    ll aa = ans.first % ans.second;
    ll bb = a.first % a.second;
    return aa * a.second < bb * ans.second;
}

pll solve(ll b,ll i){
    ll l = 0, r = N;
    while(l<r){
        ll c = (l + r + 1) / 2;
        ll a = Sm[c] - (c >= i + 1 ? abv[i].first : 0);
        if (a < As - b)
        {
            l = c;
        }
        else
        {
            r = c - 1;
        }
    }
    
    if(l==N)
        return {0l, 1l};
    ++l;
    ll a = As - Sm[l] + (l >= i + 1 ? abv[i].first : 0);
    //printf("%lld %lld\n", l, a);
    if(a<0)
        return {0l, 1l};
    return {(N - l + (l >= i + 1 ? 1 : 0)) * b - a, b};
}

int main(){
    scanf("%lld",&N);
    As = 0;
    fornum(i,0,N){
        scanf("%lld%lld", &A[i], &B[i]);
        abv[i] = {max(A[i], B[i]), i};
        As += A[i];
    }
    if(N==1){
        if(A[0]>=B[0]){
            printf("0 1");
        }else{
            j = gcd(A[0], B[0]);
            A[0] /= j;
            B[0] /= j;
            printf("%lld %lld", B[0] - A[0], B[0]);
        }
        return 0;
    }
    sort(abv, abv + N,greater<pll>());
    fornum(i,0,N){
        Sm[i + 1] = Sm[i] + abv[i].first;
    }

    ans = {0ll, 1ll};
    fornum(i,0,N){
        pll a = solve(B[abv[i].second], i);
        if(comp(a)){
            ans = a;
        }
    }
    ans.second *= N;
    j = gcd(ans.first, ans.second);
    ans.first /= j;
    ans.second /= j;
    printf("%lld %lld", ans.first, ans.second);
    return 0;
}