// ※※※ 解答不能 ※※※
// scott_wu氏
// https://atcoder.jp/contests/agc040/submissions/8277503
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

LL nt;
vector<pair<LL, LL>> res;

LL gcd(LL a, LL b){
    if(b == 0) return a;
    return gcd(b, a % b);
}

int main(){
    int N, a, b;
    scanf("%d", &N);
    for(int i = 0; i < N; i++){
        scanf("%d %d", &a, &b);
        if(a < b) nt += b - a, res.push_back(make_pair(b, b));
        else      res.push_back (make_pair (a, b));
    }
    
    sort(res.begin(), res.end());
    
    LL shi = 0;
    LL nwhole = 0;
    LL nbest = 1, dbest = 1;
    for(int i = 0; i < N; i++){
        if(res[i].first <= nt){
            nt -= res[i].first;
            shi = max(shi, res[i].second);
            nwhole++;
            continue;
        }else{
            LL nnum = res[i].first - nt;
            LL dnum = max (shi, res[i].second);
            LL g = gcd(nnum, dnum);
            nnum /= g;
            dnum /= g;
            if(nnum * dbest < dnum * nbest){
                nbest = nnum;
                dbest = dnum;
            }
        }
    }
    
    LL tnum = (nwhole + 1) * dbest - nbest;
    LL tden = N * dbest;
    LL g = gcd(tnum, tden);
    tnum /= g;
    tden /= g;
    printf("%lld %lld\n", tnum, tden);
    return 0;
}