#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXBEAM = 100000;
struct Beam {
  int a, b;
  int key;
};
bool operator<(const Beam &p, const Beam &q) { return p.key < q.key; }
struct Frac {
  long long num, den;
  Frac() : num(0), den(1) {}
  Frac(long long _num, long long _den) {
    num = _num, den = _den;
    long long g = gcd(num, den);
    num /= g;
    den /= g;
  }
};
bool operator>(const Frac &p, const Frac &q) {
  return p.num * q.den > q.num * p.den;
}
int nbeam;
Beam beam[MAXBEAM];
int nslow;
Beam slow[MAXBEAM];
int nfast;
Beam fast[MAXBEAM];
Frac solve() {
  nslow = nfast = 0;
  for (int i = (0); i < (nbeam); ++i)
    if (beam[i].a < beam[i].b)
      fast[nfast++] = beam[i];
    else
      slow[nslow++] = beam[i];
  for (int i = (0); i < (nfast); ++i) fast[i].key = fast[i].b;
  sort(fast, fast + nfast);
  for (int i = (0); i < (nslow); ++i) slow[i].key = slow[i].a;
  sort(slow, slow + nslow);
  if (nfast == 0) return Frac(0, 1);
  long long asum = 0, bsum = 0;
  for (int i = (0); i < (nfast); ++i) asum += fast[i].a;
  int atslow = 0;
  for (int i = nfast - 1; i >= 0; --i) {
    while (atslow < nslow && bsum + fast[i].b >= asum) {
      if (slow[atslow].a >= fast[i].b) break;
      if (bsum + fast[i].b >= asum + slow[atslow].a) {
        asum += slow[atslow++].a;
        continue;
      }
      if (i == 0) break;
      if (slow[atslow].a >= fast[i - 1].b) break;
      if (bsum + fast[i].b + fast[i - 1].b >= asum + slow[atslow].a) {
        asum += slow[atslow++].a;
        continue;
      }
      assert(false);
    }
    if (bsum + fast[i].b >= asum) {
      int ipart = atslow + i;
      Frac fpart(bsum + fast[i].b - asum, fast[i].b);
      for (int k = (atslow); k < (nslow); ++k) {
        assert(bsum + fast[i].b < asum + slow[k].a);
        if (bsum + fast[i].b + slow[k].b < asum + slow[k].a) continue;
        Frac cpart(bsum + fast[i].b + slow[k].b - asum - slow[k].a, slow[k].b);
        if (cpart > fpart) fpart = cpart;
      }
      return Frac((long long)ipart * fpart.den + fpart.num,
                  (long long)fpart.den * nbeam);
    }
    bsum += fast[i].b;
  }
  assert(false);
  return Frac(0, 1);
}
void run() {
  scanf("%d", &nbeam);
  for (int i = (0); i < (nbeam); ++i) scanf("%d%d", &beam[i].a, &beam[i].b);
  Frac ans = solve();
  printf("%lld %lld\n", ans.num, ans.den);
}
int main() {
  run();
  return 0;
}
