#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool vmax(T& a, T b) {
  return (a < b) ? (a = b, true) : (false);
}
const int N = 1e5 + 5;
const long long llf = 1e17;
const int inf = (signed)(~0u >> 2);
long long gcd(long long a, long long b) { return (b) ? (gcd(b, a % b)) : (a); }
typedef class Fraction {
 public:
  long long a, b;
  Fraction() : a(0), b(1) {}
  Fraction(long long a, long long b) : a(a), b(b) {}
  bool operator<(Fraction B) const {
    return ((long double)a) * B.b - ((long double)b) * B.a < 0;
  }
  bool operator>(Fraction B) const {
    return ((long double)a) * B.b - ((long double)b) * B.a > 0;
  }
} Fraction;
int n;
vector<pair<int, int> > pos, neg;
int main() {
  scanf("%d", &n);
  if (n > 10000) return 114514;
  for (int i = 1, a, b; i <= n; i++) {
    scanf("%d%d", &a, &b);
    if (a <= b) {
      pos.emplace_back(a, b);
    } else {
      neg.emplace_back(a, b);
    }
  }
  long long sum = 0;
  for (auto par : pos) sum += par.second - par.first;
  sort(pos.begin(), pos.end(),
       [&](const pair<int, int>& a, const pair<int, int>& b) {
         return a.second < b.second;
       });
  sort(neg.begin(), neg.end());
  vector<pair<int, int> >::iterator pp = pos.begin(), _pp = pos.end();
  vector<pair<int, int> >::iterator pn = neg.begin(), _pn = neg.end();
  Fraction ans(0, 1), I(1, 1);
  for (int i = 0; i < n && sum > 0; i++) {
    Fraction tmp(-1, 1);
    vmax(tmp, Fraction(sum, (*pp).second));
    for (vector<pair<int, int> >::iterator it = pn; it != _pn; it++)
      vmax(tmp, Fraction(sum - (*it).first + (*it).second, (*it).second));
    if (tmp.a > 0) {
      tmp = min(tmp, I);
      tmp.a += tmp.b * i;
      vmax(ans, tmp);
    }
    if (pp != _pp && (pn == _pn || (*pp).second < (*pn).first)) {
      sum -= (*pp).second;
      pp++;
    } else {
      sum -= (*pn).first;
      pn++;
    }
  }
  long long g = gcd(ans.a, ans.b *= n);
  ans.a /= g;
  ans.b /= g;
  printf("%lld %lld\n", ans.a, ans.b);
  return 0;
}
