#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e17;
const long long mod = 998244353;
const long long maxN = 300000;
struct frac {
  long long u, d;
};
bool cmp(const frac &a, const frac &b) { return a.u * b.d < a.d * b.u; }
long long a[100006], b[100006];
long long rw[100006], id[100006];
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
signed main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i] >> b[i];
  vector<long long> ka;
  frac ans1 = {0, 1};
  long long sa = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] <= b[i]) {
      ka.push_back(b[i]);
      sa += a[i];
    }
  }
  if (ka.empty()) {
    cout << "0 1" << endl;
    return 0;
  }
  vector<pair<long long, long long>> kb;
  for (long long i = 0; i < n; i++) {
    if (a[i] > b[i]) kb.push_back(pair<long long, long long>(a[i], -b[i]));
  }
  sort(kb.begin(), kb.end());
  long long N = kb.size();
  for (long long i = 0; i < N; i++) kb[i].second *= -1;
  priority_queue<long long> Q1;
  priority_queue<long long, vector<long long>, greater<long long>> Q2;
  for (long long i = 0; i < ka.size(); i++) Q1.push(ka[i]);
  Q1.push(-inf);
  Q2.push(inf);
  long long s2 = 0;
  for (long long I = 0; I < N + 1; I++) {
    while (s2 < sa && Q1.size()) {
      Q2.push(Q1.top());
      s2 += Q1.top();
      Q1.pop();
    }
    if (Q1.size() == 0) break;
    long long U = s2 - sa, D = Q2.top();
    U += D * (Q1.size() - 1);
    D *= n;
    long long G = gcd(D, U);
    D /= G;
    U /= G;
    ans1 = max(ans1, {U, D}, cmp);
    if (I != N) {
      if (Q1.top() <= kb[I].second) {
        Q1.push(kb[I].second);
      } else {
        Q2.push(kb[I].second);
        s2 += kb[I].second;
        while (s2 > sa) {
          s2 -= Q2.top();
          Q1.push(Q2.top());
          Q2.pop();
        }
      }
      sa += kb[I].first;
    }
  }
  cout << ans1.u << ' ' << ans1.d << endl;
}
