#include<bits/stdc++.h>

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<pair<unsigned long, unsigned long>> B(N);
    for(auto& i : B)cin >> i.first >> i.second;
    auto it = partition(B.begin(), B.end(), [](auto i){return i.first < i.second;});
    sort(B.begin(), it, greater<>());
    sort(it, B.end(), [](auto i, auto j){return i.first == j.first ? i.second > j.second : i.first < j.first;});
    priority_queue<long> small;
    priority_queue<long, vector<long>, greater<>> large{greater<>()};
    long ss{0}, cs{0}, sl{0}, cl{0}, n{~0L}, S{0};
    long rem{0};
    long ansnum{0}, ansden{1};
    for(unsigned long i = 0; i < N; ++i){
        S += B[i].first;
        rem += B[i].first;
        auto k = B[i].second;
        if(!~n){
            n = k;
        }else if(n < k){
            large.push(k);
            sl += k;
            ++cl;
            rem -= k;
        }else{
            small.push(k);
            ss += k;
            ++cs;
        }
        while(rem >= n && !small.empty()){
            large.push(n);
            sl += n;
            ++cl;
            rem -= n;
            n = small.top();
            small.pop();
            ss -= n;
            --cs;
        }
        while(rem < 0 && !large.empty()){
            small.push(n);
            ss += n;
            ++cs;
            n = large.top();
            large.pop();
            sl -= n;
            --cl;
            rem += n;
        }
        long kn = n * (i + 1 - cl) - rem, kd = n;
        {
            long g = __gcd(kn, kd);
            kn /= g;
            kd /= g;
        }
        if(kd < 0){
            kn *= -1;
            kd *= -1;
        }
        if(kn > 0 && kn * ansden > kd * ansnum){
            ansnum = kn;
            ansden = kd;
        }
    }
    ansden *= N;
    {
        long g = __gcd(ansnum, ansden);
        ansnum /= g;
        ansden /= g;
    }
    cout << ansnum << " " << ansden << endl;
    return 0;
}