#include <bits/stdc++.h>
#define pb push_back
#define pll pair <ll, ll>
#define mp make_pair
#define pyshnapyshnakaa ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define x first
#define y second
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
#define plll pair <pair <ll, ll>, ll>
#define pllll pair <pair <ll, ll>, pair <ll, ll> >
#define psl pair <string, ll>
#define all(a) a.begin(), a.end()

typedef long long ll;

typedef long double ld;

using namespace std;

const ll maxn = 1e6;

ll n, m, k, t;

vector <pll> A;

vector <ll> S;

ll C[maxn];

ll gcd(ll a, ll b) {
    while (a != 0) {
        b = b % a;
        swap(a, b);
    }
    return b;
}

bool cmp(pll a, pll b) {
    return max(a.first, a.second) > max(b.first, b.second);
}

void minmin(pll &a, pll b) {
    if (a.first * 1.0 / a.second > b.first * 1.0 / b.second) {
        a = b;
    }
    // if (a.first * b.second > a.second * b.first) {
    //     // cout << "CHECK_MOM" << endl;
    //     // cout << a.first * b.second << " " << a.second * b.first << endl;
    //     a = b;
    // }
}

pll getsum(pll s1, pll s2) {
    ll g = gcd(abs(s1.second), abs(s2.second));
    ll lc = (s1.second / g) * s2.second;
    // ll lc = s1.second * s2.second / gcd(abs(s1.second), abs(s2.second));
    return mp(s1.first * (lc / s1.second) + s2.first * (lc / s2.second), lc);
}

inline void ease(pll &p) {
    ll g = gcd(p.first, p.second);
    p.first /= g;
    p.second /= g;
} 

int main() {
    pyshnapyshnakaa;
    ll q, w, e, a, b, c;
    cin >> n;
    ll sum = 0;
    for (q = 0; q < n; q++) {
        cin >> a >> b;
        sum += a;
        A.pb(mp(a, b));
    }
    sort(all(A), cmp);
    // for (q = 0; q < A.size(); q++) {
    //     cout << A[q].first << " " << A[q].second << endl;
    // }
    // cout << endl << endl;
    S.resize(n);
    S[0] = max(A[0].first, A[0].second);
    for (q = 1; q < n; q++) {
        S[q] = S[q - 1] + max(A[q].first, A[q].second);
    }
    pll ans = mp(1, 1);
    for (q = 0; q < n; q++) {
        // if (q != 4 && q != 6) {
        //     continue;
        // }
        // cout << "Q " << q << endl;
        // ll d1 = max(A[q].second, A[q].first);
        ll d1 = A[q].second;
        ll i = lower_bound(all(S), sum - d1) - S.begin();
        // cout << "I " << i << endl; 
        if (i >= n) {
            continue;
        }
        ll cnt = i + 1;
        ll t = S[i];
        ll d = max(A[q].first, A[q].second);
        // ll d = A[q].first;
        if (i >= q) {
            i = lower_bound(all(S), sum - d1 + d) - S.begin();
            if (i >= n) {
                continue;
            }
            cnt = i;
            t = S[i] - d;
        }
        if (i >= n) {
            continue;
        }
        // cout << t << " " << cnt << " " << sum << " " << A[q].second << " T CNT sum second" << endl;
        // cout << "DEBUG " << t - sum + A[q].second << endl;
        pll zhopa = mp(sum - t, A[q].second);
        // zhopa.first *= -1;
        // zhopa = getsum(mp(1, 1), zhopa);
        // cout << zhopa.first << " " << zhopa.second << " ZHOPA1" << endl;
        zhopa.second *= n;
        ease(zhopa);
        // cout << zhopa.first << " " << zhopa.second << " ZHOPA" << endl;
        if (sum - t > A[q].second || sum - t < 0) {
            // cout << "POOOOOOHUUUUUUUUUI" << endl << endl << endl;
            continue;
        }
        pll dans = getsum(zhopa, mp(cnt, n));
        ease(dans);
        // cout << "DANS " << dans.first << " " << dans.second << endl;
        minmin(ans, dans); 
        // cout << endl << endl;
    }
    ans.first = ans.second - ans.first;
    // pll p1 = mp(697461712,2899550585);
    // minmin(ans, p1);
    ease(ans);/**/
    cout << ans.first << " " << ans.second;
    return 0;
}
