#include <bits/stdc++.h>
using namespace std;
const int N = (int)3e5;
long long int mpow(long long int a, long long int b) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0) {
    long long int memo = mpow(a, b / 2);
    return memo * memo % (long long int)(1e9 + 7);
  } else
    return mpow(a, b - 1) * a % (long long int)(1e9 + 7);
}
long long int lpow(long long int a, long long int b) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0) {
    long long int memo = lpow(a, b / 2);
    return memo * memo;
  } else
    return lpow(a, b - 1) * a;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
vector<long long int> kaijo_memo;
long long int kaijo(long long int n) {
  if (kaijo_memo.size() > n) return kaijo_memo[n];
  if (kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while (kaijo_memo.size() <= n)
    kaijo_memo.push_back(kaijo_memo[kaijo_memo.size() - 1] * kaijo_memo.size() %
                         (long long int)(1e9 + 7));
  return kaijo_memo[n];
}
vector<long long int> gyaku_kaijo_memo;
long long int gyaku_kaijo(long long int n) {
  if (gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if (gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while (gyaku_kaijo_memo.size() <= n)
    gyaku_kaijo_memo.push_back(
        gyaku_kaijo_memo[gyaku_kaijo_memo.size() - 1] *
        mpow(gyaku_kaijo_memo.size(), (long long int)(1e9 + 7) - 2) %
        (long long int)(1e9 + 7));
  return gyaku_kaijo_memo[n];
}
long long int nCr(long long int n, long long int r) {
  if (n == r) return 1;
  if (n < r || r < 0) return 0;
  long long int ret = 1;
  ret *= kaijo(n);
  ret %= (long long int)(1e9 + 7);
  ret *= gyaku_kaijo(r);
  ret %= (long long int)(1e9 + 7);
  ret *= gyaku_kaijo(n - r);
  ret %= (long long int)(1e9 + 7);
  return ret;
}
int main(void) {
  long long int n;
  cin >> n;
  vector<pair<long long int, long long int>> C;
  vector<long long int> A, B;
  long long int sum = 0, maxB = 0, bi = -1;
  for (int i = 0; i < (int)(n); i++) {
    long long int a, b;
    cin >> a >> b;
    A.push_back(a);
    B.push_back(b);
    sum += a;
    if (a <= b) {
      C.push_back({b, i});
      if (maxB < b) {
        maxB = b;
        bi = i;
      }
    } else {
      C.push_back({a, i});
    }
  }
  if (bi == -1) {
    cout << 0 << " " << 1 << endl;
    return 0;
  }
  vector<long long int> used;
  C.erase(C.begin() + bi);
  used.push_back(bi);
  sort(C.begin(), C.end());
  reverse(C.begin(), C.end());
  sum -= maxB;
  long long int ci = 0;
  while (sum > 0) {
    sum -= C[ci].first;
    used.push_back(C[ci].second);
    ci++;
    if (sum >= 0 && ci == C.size()) {
      cout << 0 << " " << 1 << endl;
      return 0;
    }
  }
  double minCost = (long long int)(112345678901234567);
  long long int minBi = -1;
  for (int i = 0; i < (int)(used.size()); i++) {
    int ui = used[i];
    if (A[ui] > B[ui]) continue;
    double cost = 1.0 * (sum + B[ui]) / B[ui];
    if (cost <= 0) continue;
    if (minCost > cost) {
      minCost = cost;
      minBi = ui;
    }
  }
  sum += B[minBi];
  maxB = B[minBi];
  long long int bunsi = n * maxB - maxB * ci - sum, bunbo = n * maxB;
  long long int yaku = gcd(bunsi, bunbo);
  cout << bunsi / yaku << " " << bunbo / yaku << endl;
  return 0;
}
