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

#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

struct rational {
    long long num, den;
    static long long gcd(long long a, long long b) {
        if (a < 0) { a = -a; }
        if (b < 0) { b = -b; }
        while (b) { std::swap(a %= b, b); }
        return a;
    }
    void reduce() {
        long long g = gcd(num, den);
        num /= g, den /= g;
    }
    rational(long long num_ = 0, long long den_ = 1, bool reduction = true) : num(num_), den(den_) {
        if (reduction) { reduce(); }
        if (den < 0) { num = -num, den = -den; }
    }
    bool operator==(const rational &rhs) const { return num == rhs.num && den == rhs.den; }
    bool operator!=(const rational &rhs) const { return std::rel_ops::operator!=(*this, rhs); }
    bool operator<(const rational &rhs) const { return to_double() < rhs.to_double(); }
    bool operator>(const rational &rhs) const { return std::rel_ops::operator>(*this, rhs); }
    bool operator<=(const rational &rhs) const { return std::rel_ops::operator<=(*this, rhs); }
    bool operator>=(const rational &rhs) const { return std::rel_ops::operator>=(*this, rhs); }
    rational &operator+=(const rational &rhs) {
        num = num * rhs.den + rhs.num * den, den *= rhs.den;
        reduce();
        return *this;
    }
    rational &operator-=(const rational &rhs) { return *this += -rhs; }
    rational &operator*=(const rational &rhs) {
        num *= rhs.num, den *= rhs.den;
        reduce();
        return *this;
    }
    rational &operator/=(const rational &rhs) { return *this *= rhs.inv(); }
    rational operator+() const { return *this; }
    rational operator-() const { return rational(-num, den, false); }
    rational operator+(const rational &rhs) const { return rational(*this) += rhs; }
    rational operator-(const rational &rhs) const { return rational(*this) -= rhs; }
    rational operator*(const rational &rhs) const { return rational(*this) *= rhs; }
    rational operator/(const rational &rhs) const { return rational(*this) /= rhs; }
    rational inv() const { return rational(den, num, false); }
    rational pow(long long n) const {
        if (n < 0) { return pow(-n).inv(); }
        rational ret(1, 1, false), mul = *this;
        while (n > 0) {
            if (n & 1) { ret.num *= mul.num, ret.den *= mul.den; }
            mul.num *= mul.num, mul.den *= mul.den;
            n >>= 1;
        }
        return ret;
    }
    double to_double() const { return (double) num / den; }
    friend std::istream &operator>>(std::istream &is, rational &rhs) {
        long long n, d;
        char s;
        is >> n >> s >> d;
        rhs = rational(n, d);
        return is;
    }
    friend std::ostream &operator<<(std::ostream &os, const rational &rhs) {
        return os << rhs.num << " / " << rhs.den;
    }
};

template<typename F> long long discrete_binary_search(long long ok, long long ng, F is_ok) {
    while (abs(ok - ng) > 1) {
        long long mid = (ok + ng) / 2;
        (is_ok(mid) ? ok : ng) = mid;
    }
    return ok;
}

int N;
int A[110000], B[110000];
pint mB[110000];
int mcc[110000];
signed main() {
    cin >> N;
    int S = 0;
    rep(i, N) {
        cin >> A[i] >> B[i];
        S += A[i];
        mB[i] = {max(A[i], B[i]), B[i]};
    }
    sort(mB, mB + N), reverse(mB, mB + N);
    rep(i, N) { mcc[i + 1] = mcc[i] + mB[i].first; }
    rational ans = 0;
    rep(i, N) {
        int k = discrete_binary_search(N - 1, -1, [&](int x) {
            int a;
            if (x > i) { a = mcc[x + 1] - mB[i].first; }
            else { a = mcc[x]; }
            return a >= S - mB[i].second;
        });
        int a;
        if (k > i) { a = mcc[k + 1] - mB[i].first; }
        else { a = mcc[k]; }
        int b = S - a;
        if (b < 0) { continue; }
        chmax(ans, -(rational(b) / mB[i].second + k) + N);
    }
    ans /= N;
    cout << ans.num << " " << ans.den << endl;
}

Measured memory_bytes: 4352