#include<iostream>
#include<string>
#include <algorithm>
using namespace std;

int main()
{
    int N;
    cin >> N;
    long long A[N],B[N];

    double timeA=0, timeB=0;
    double times;
    for(int i=0; i<N; i++){
        cin >> A[i] >> B[i];
        timeA += 1/(double)A[i];
        timeB += 1/(double)B[i];
    }
    if(timeA<=timeB){
        cout << 0 << " "<< 1 << endl;
        return 0;
    }

    sort(B,B+N,less<>());
    times = timeB-timeA;

    double ians;
    int icheck;
    for(int i=0; i<N; i++){
        times -= 1/(double)B[i];
        if(times<=0){
            times += 1/(double)B[i];
            ians = times/(double)B[i];
            icheck = i;
            break;
        }
    }

    long long P,Q;
    P = ians + (N-1-icheck);
    Q = N;
    for(int i=P; i>0; i--){
        if(P%i==0 && Q%i==0){
            P /= i;
            Q /= i;
            break;
        }
    }

    cout << P << " "<< Q <<endl;

    return 0;

}