#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

template<class T>
T gcd(T n,T m){
    if(n>m) return gcd(m,n);
    else if(n==0) return m;
    else return gcd(m-n*(m/n),n);
}

struct rat{
    ll p,q;
    rat(ll p_=0,ll q_=1){
        ll k=gcd(abs(p_),abs(q_));
        p=(p_/k)*(q_/abs(q_));
        q=abs(q_)/k;
    }
    bool operator==(const rat& x){
        return p==x.p&&q==x.q;
    }
    bool operator<(const rat& x){
        return p*x.q<x.p*q;
    }
    bool operator>(const rat& x){
        return p*x.q>x.p*q;
    }
    rat& operator=(const rat& x){
        p=x.p;q=x.q;
        return *this;
    }
    rat operator+(const rat& x){
        rat y(p*x.q+x.p*q,q*x.q);
        return y;
    }
    rat operator-(const rat& x){
        rat y(p*x.q-x.p*q,q*x.q);
        return y;
    }
    rat operator*(const rat& x){
        rat y(p*x.p,q*x.q);
        return y;
    }
    rat operator/(const rat& x){
        rat y(p*x.q,q*x.p);
        return y;
    }
    rat& operator+=(const rat& x){
        *this=*this+x;
        return *this;
    }
    rat& operator-=(const rat& x){
        *this=*this-x;
        return *this;
    }
    rat& operator*=(const rat& x){
        *this=*this*x;
        return *this;
    }
    rat& operator/=(const rat& x){
        *this=*this/x;
        return *this;
    }
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    ll S{};
    int n;
    in>>n;
    vector<int> a(n),b(n),p(n),v(n);
    vector<ll> s(n+1);
    fr(i,n) in>>a[i]>>b[i],p[i]=i,S+=a[i];
    sort(p.begin(),p.end(),[&](int i,int j){
        return max(a[i],b[i])>max(a[j],b[j]);
    });
    for(int i=0,j=p[0];i<n;++i,j=p[i]){
        s[i+1]=s[i]+max(a[j],b[j]);
        v[j]=i;
    }
    using ld=long double;
    ld x=0,nx;
    ll ap=0,aq=1;
    for(auto i:p){
        int j=lower_bound(s.begin(),s.end(),S-b[i])-s.begin();
        if(v[i]>=j){
            if(S-s[j]<0) continue;
            nx=(ld)((ll)(n-j)*b[i]-S+s[j])/((ll)n*b[i]);
            if(nx>x){
                x=nx;
                rat r((ll)(n-j)*b[i]-S+s[j],(ll)n*b[i]);
                ap=r.p,aq=r.q;
            }
        }
        else{
            j=lower_bound(s.begin(),s.end(),S+max(a[i],b[i])-b[i])-s.begin();
            if(S-s[j]+max(a[i],b[i])<0) continue;
            nx=(ld)((ll)(n-j+1)*b[i]-S+s[j]-max(a[i],b[i]))/((ll)n*b[i]);
            if(nx>x){
                x=nx;
                rat r((ll)(n-j+1)*b[i]-S+s[j]-max(a[i],b[i]),(ll)n*b[i]);
                ap=r.p,aq=r.q;
            }
        }
    }
    cout<<ap<<" "<<aq<<endl;
}