#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
struct Bunsuu {
//    using T = __int128;
    using T = Int;
    T p, q; // p/q

    Bunsuu(T p_, T q_) : p(p_), q(q_) {

    }

    Bunsuu(pair<T, T> aPair) : p(aPair.first), q(aPair.second) {

    }

    Bunsuu operator+(Bunsuu right) const {
        T bunbo = q * right.q;
        T bunshi = p * right.q + right.p * q;
        return Bunsuu(yakubun(bunshi, bunbo));
    }

    Bunsuu operator-(Bunsuu right) const {
        T bunbo = q * right.q;
        T bunshi = p * right.q - right.p * q;
        return Bunsuu(yakubun(bunshi, bunbo));
    }

    Bunsuu operator*(Bunsuu right) const {
        T bunbo = q * right.q;
        T bunshi = p * right.p;
        return Bunsuu(yakubun(bunshi, bunbo));
    }

    Bunsuu operator/(Bunsuu right) const {
        T bunbo = q * right.p;
        T bunshi = p * right.q;
        return Bunsuu(yakubun(bunshi, bunbo));
    }

    bool operator<(Bunsuu right) const {
        Bunsuu L(yakubun(p, q));
        Bunsuu R(yakubun(right));
        return L.p * R.q < L.q * R.p;
    }

    bool operator>(Bunsuu right) const {
        return right < *this;
    }

    bool operator<=(Bunsuu right) const {
        return !(*this > right);
    }

    bool operator>=(Bunsuu right) const {
        return !(*this < right);
    }

    bool operator==(Bunsuu right) const {
        return *this <= right && *this >= right;
    }

    bool operator!=(Bunsuu right) const {
        return !(*this == right);
    }

    void print() const {
        cout << (Int) p << "/" << (Int) q << endl;
    }

    ll gcd(ll a, ll b) const {
        a = abs(a);
        b = abs(b);
        if (a < b) swap(a, b);
        if (a % b == 0) return b;

        return gcd(b, a % b);
    }

    pair<T, T> yakubun(T p, T q) const {
        if (p == 0)return pair<T, T>(0ll, 1ll);
        T gcd_v = gcd(p, q);
        p /= gcd_v;
        q /= gcd_v;
        if (q < 0) {
            p = -p;
            q = -q;
        }
        return pair<T, T>(p, q);
    }

    pair<T, T> yakubun(Bunsuu bunsuu) const {
        return yakubun(bunsuu.p, bunsuu.q);
    }

    double value() const {
        return 1.0 * p / q;
    }
};

class Solve {
public:
    void solve() {
        Int N;
        cin >> N;
        vector<pair<Int, Int>> AB(N);
        vector<pair<Int, Int>> X, Y;
        for (int i = 0; i < N; ++i) {
            cin >> AB[i].first >> AB[i].second;
            if (AB[i].first > AB[i].second) {
                Y.push_back(AB[i]);
            } else {
                X.push_back(AB[i]);
            }
        }

        if (X.size() == 0) {
            cout << 0 << " " << 1 << endl;
            return;
        }

        sort(all(X), [](auto a, auto b) {
            return a.second < b.second;
        });
        sort(all(Y), [](auto a, auto b) {
            return a.first < b.first;
        });

        Int max_rest = 0;
        Int rest = 0;
        for (auto e : X) {
            rest += e.second - e.first;
        }
        max_rest = rest;
        Int P = 0, Q = 1;
        Bunsuu PQ(0, 1);
        double ans = 0.0;
        Int lpt = 0, rpt = 0;
        {
            Int tmp = 0;
            Int p = 0;
            int idx = 0;
            for (; idx < X.size(); ++idx) {
                if (tmp + X[idx].second <= rest) {
                    p++;
                    tmp += X[idx].second;
                } else {
                    break;
                }
            }
            Bunsuu pq(p, 1);
            if (idx < X.size()) {
                Bunsuu neri(rest - tmp, X[idx].second);
                pq = pq + neri;
            }
            PQ = pq;
            lpt = idx;
            rest -= tmp;
        }

        Int rest2 = 0; //A > Bのrest
        while (lpt >= 0) {
//            while (rpt < Y.size() && Y[rpt].first + rest + rest2 <= max_rest) {
            while (rpt < Y.size() && rest >= rest2 + Y[rpt].first) {
                rest2 += Y[rpt].first;
                rpt++;


                if (rest + rest2 <= max_rest) {
                    Bunsuu tapi(lpt + rpt, 1);
                    Bunsuu neri((rest - rest2), X[lpt].second);
                    Bunsuu one = tapi + neri;
                    if (PQ.value() < one.value()) {
                        PQ = one;
                    }
                }
            }

            if (rest + rest2 <= max_rest) {
                Bunsuu tapi(lpt + rpt, 1);
                Bunsuu neri((rest - rest2), X[lpt].second);
                Bunsuu one = tapi + neri;
                if (PQ.value() < one.value()) {
                    PQ = one;
                }
            }

            lpt--;
            rest += X[lpt].second;
        }

        PQ = PQ / Bunsuu(N, 1);

        cout << (Int) (PQ.p) << " " << (Int) PQ.q << endl;


    }

};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}
