#include <bits/stdc++.h>
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  int n;
  scanf("%d", &n);
  std::vector<long long> A(n), B(n);
  for (int i = 0; i < n; i++) {
    scanf("%lld%lld", &A[i], &B[i]);
  }
  std::vector<std::pair<long long, int> > P(n);
  for (int i = 0; i < n; i++) {
    P[i] = std::make_pair(std::max(A[i], B[i]), i);
  }
  std::sort(P.begin(), P.end());
  long long S = 0ll;
  for (int i = 0; i < n; i++) S += A[i];
  long long ansp = 0, ansq = 1;
  for (int k = 0; k < n; k++) {
    long long s = 0ll;
    int c = 0;
    for (int t = n - 1; t >= 0; t--) {
      int i = P[t].second;
      if (i == k) continue;
      s += P[t].first;
      c++;
      if (s + B[k] >= S) break;
    }
    long long q = B[k];
    long long p = B[k] * (n - 1 - c) + (B[k] - std::max(0ll, S - s));
    if (ansp / ansq < p / q ||
        (ansp / ansq == p / q &&
         (ansp - ansp / ansq * ansq) * q < (p - p / q * q) * ansq)) {
      ansp = p;
      ansq = q;
    }
  }
  long long g = gcd(ansp, ansq * n);
  printf("%lld %lld\n", ansp / g, ansq * n / g);
  return 0;
}
