#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define ALL(c) (c).begin(), (c).end()

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

bool cmp(ll a, ll b, ll c, ll d) {
    return (__int128)a * d - (__int128)b * c > 0;
}

int main() {
    int N;
    cin >> N;
    V<int> A(N), B(N);
    ll sum = 0;
    rep(i, N) {
        cin >> A[i] >> B[i];
        sum += A[i];
    }

    ll a = TEN(18), b = 1;
    rep(i, N) {
        V<ll> vec;
        rep(j, N) if (j != i) { vec.pb(max(A[j], B[j])); }
        sort(ALL(vec));
        reverse(ALL(vec));
        ll t = sum;
        int k = 0;
        rep(j, N - 1) {
            if (t <= B[i]) {
                break;
            }
            t -= vec[j];
            k++;
        }
        if (t < 0) {
            continue;
        }
        ll p = t + (ll)B[i] * k, q = B[i];
        if (cmp(a, b, p, q)) {
            a = p, b = q;
        }
    }
    b *= N;
    a = b - a;
    if (a < 0) a = 0;
    {
        ll d = __gcd(a, b);
        a /= d;
        b /= d;
    }
    cout << a << " " << b << endl;

    return 0;
}