#include <bits/stdc++.h>
using namespace std;
using Pi = pair<int, int>;
int N;
vector<int> A, B;
int main() {
  long long ans1 = 0, ans2 = 1;
  double ansf = 0.0;
  cin >> N;
  A = vector<int>(N);
  B = vector<int>(N);
  vector<Pi> T(0);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    cin >> B[i];
    T.push_back(make_pair(A[i], B[i]));
  }
  sort(T.begin(), T.end(), [](Pi const& l, Pi const& r) {
    bool lt = l.first < l.second;
    bool rt = r.first < r.second;
    if (lt != rt) {
      return lt;
    }
    if (lt) {
      return l.second < r.second;
    }
    return l.first < r.first;
  });
  long long Amem = 0;
  long long Bplusmem = 0;
  int pmem = 0;
  for (int j = 0; j < N; j++) {
    int p = pmem;
    long long Asum = Amem;
    long long Bplussum = Bplusmem;
    if (Asum == 0) {
      bool no_cont = true;
      for (int i = 0; i < N; i++) {
        if (i == j) {
          no_cont = false;
          continue;
        }
        if (T[i].first < T[i].second) {
          Asum += T[i].first;
          Bplussum += T[i].second;
        } else {
          Asum += T[i].first;
          p++;
          if (Bplussum < Asum) {
            Asum -= T[i].first;
            p--;
            break;
          }
        }
      }
      if (no_cont) {
        Amem = Asum;
        Bplusmem = Bplussum;
        pmem = p;
      }
    }
    long long dif = Bplussum + T[j].second - Asum - T[j].first;
    if (dif < 0 || dif > T[j].second) {
      continue;
    }
    long long a1 = dif + p * (long long)T[j].second;
    long long a2 = T[j].second * (long long)N;
    double f = a1 / (double)a2;
    if (f > ansf) {
      ansf = f;
      ans1 = a1;
      ans2 = a2;
    }
  }
  for (long long i = 2; i * i <= ans1; i++) {
    while (ans1 % i == 0 && ans2 % i == 0) {
      ans1 /= i;
      ans2 /= i;
    }
  }
  if (ans1 != 0 && ans2 % ans1 == 0) {
    ans2 /= ans1;
    ans1 = 1;
  }
  cout << ans1 << " " << ans2 << endl;
  return 0;
}
