#include <bits/stdc++.h>
using namespace std;
__int64_t gcd(__int64_t a, __int64_t b) {
  while (b > 0) {
    __int64_t c = a % b;
    a = b;
    b = c;
  }
  return a;
}
struct seg {
  __int64_t a, b;
};
int main() {
  int n;
  cin >> n;
  vector<seg> s(n);
  for (int i = 0; i < n; i++) {
    __int64_t x, y;
    cin >> x >> y;
    s[i].a = x;
    s[i].b = y;
  }
  vector<seg> plus;
  vector<seg> minus;
  __int64_t dif = 0;
  __int64_t m = 0;
  for (int i = 0; i < n; i++) {
    if (s[i].b > s[i].a) {
      plus.push_back(s[i]);
      dif -= s[i].a;
      m++;
    } else {
      minus.push_back(s[i]);
    }
  }
  sort(plus.begin(), plus.end(),
       [](const seg &a, const seg &b) { return a.b > b.b; });
  sort(minus.begin(), minus.end(),
       [](const seg &a, const seg &b) { return a.a > b.a; });
  __int64_t pr = 0;
  __int64_t qr = 1;
  for (int i = 0; i < plus.size(); i++) {
    dif += plus[i].b;
    m--;
    if (dif >= 0) {
      while (minus.size() > 0 && minus.back().a <= dif) {
        dif -= minus.back().a;
        minus.pop_back();
        m++;
      }
      __int64_t p = m * plus[i].b + dif;
      __int64_t q = plus[i].b * n;
      __int64_t d = gcd(p, q);
      p /= d;
      q /= d;
      if ((__int128_t)p * qr > (__int128_t)pr * q) {
        pr = p;
        qr = q;
      }
    }
  }
  cout << pr << " " << qr << "\n";
  return 0;
}
