#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n;
  cin >> n;
  vector<pair<long long int, long long int> > v1, v2;
  for (int i = 0; i < n; i++) {
    long long int a, b;
    cin >> a >> b;
    if (b >= a)
      v1.push_back({b, a});
    else
      v2.push_back({a, b});
  }
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());
  int n1 = v1.size(), n2 = v2.size();
  vector<long long int> sc1(n1 + 1), sa1(n1 + 1), sa2(n2 + 1), mnb(n1 + 1),
      mnb2(n2 + 1);
  mnb[n1] = 1e9 + 7, mnb2[0] = 1e9 + 7;
  for (int i = n1 - 1; i >= 0; i--) mnb[i] = min(mnb[i + 1], v1[i].first);
  for (int i = 0; i < n2; i++) mnb2[i + 1] = min(mnb2[i], v2[i].second);
  for (int i = 0; i < n1; i++) {
    sc1[i + 1] = sc1[i] + v1[i].first - v1[i].second;
    sa1[i + 1] = sa1[i] + v1[i].second;
  }
  for (int i = 0; i < n2; i++) sa2[i + 1] = sa2[i] + v2[i].first;
  auto check = [&](int m) {
    for (int i = 0; i <= min(m, n2); i++) {
      if (m - i > n1) continue;
      long long int s = -sa2[i] - sa1[m - i] + sc1[n1] - sc1[m - i];
      if (s >= 0) return true;
    }
    return false;
  };
  int l = 0, r = n;
  while (r - l > 1) {
    int mid = (l + r) / 2;
    if (check(mid))
      l = mid;
    else
      r = mid;
  }
  vector<long long int> mxs(n2 + 2);
  mxs[0] = -1;
  using lll = __int128_t;
  pair<long long int, long long int> ans =
      pair<long long int, long long int>(0, 1);
  for (int i = 0; i <= min(l, n2); i++) {
    long long int s = -1;
    if (l - i <= n1) s = -sa2[i] - sa1[l - i] + sc1[n1] - sc1[l - i];
    mxs[i + 1] = max(mxs[i], s);
    if (s < 0) continue;
    if ((lll)ans.first * mnb[l - i] <= (lll)s * ans.second)
      ans = pair<long long int, long long int>(s, mnb[l - i]);
  }
  for (int i = min(l, n2) + 1; i <= n2; i++) mxs[i + 1] = mxs[i];
  for (int i = 0; i < n2; i++) {
    if (mxs[i + 1] + v2[i].second - v2[i].first < 0) continue;
    if ((lll)ans.first * v2[i].second <=
        (lll)(mxs[i + 1] + v2[i].second - v2[i].first) * ans.second)
      ans = pair<long long int, long long int>(
          mxs[i + 1] + v2[i].second - v2[i].first, v2[i].second);
  }
  for (int i = 1; i <= n2 && i - 1 <= l; i++) {
    long long int s = -1;
    if (l - i + 1 <= n1)
      s = -sa2[i] - sa1[l - i + 1] + sc1[n1] - sc1[l - i + 1] + mnb2[i];
    if (s < 0) continue;
    if ((lll)ans.first * mnb2[i] <= (lll)s * ans.second)
      ans = pair<long long int, long long int>(s, mnb2[i]);
  }
  for (int i = 0; i <= min(l, n2); i++) {
    long long int s = -1;
    if (l - i + 1 <= n1)
      s = -sa2[i] - sa1[l - i + 1] + sc1[n1] - sc1[l - i + 1] + v1[0].first;
    if (s < 0) continue;
    if ((lll)ans.first * v1[0].first <= (lll)s * ans.second)
      ans = pair<long long int, long long int>(s, v1[0].first);
  }
  ans = pair<long long int, long long int>(ans.first + l * ans.second,
                                           ans.second * n);
  long long int g = gcd(ans.first, ans.second);
  cout << ans.first / g << " " << ans.second / g << endl;
  return 0;
}
