#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <iomanip>
#include <functional>
#include <cassert>

using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) {
  return (b == 0 ? a : gcd(b, a % b));
}

struct Frac {
  ll a, b;
  void normalize() {
    ll g = gcd(a, b);
    a /= g;
    b /= g;
  }
  Frac(ll _a, ll _b) {
    a = _a;
    b = _b;
    normalize();
  }
  bool operator <(const Frac &other) const {
    return (__int128)a * other.b < (__int128)b * other.a;
  }
};

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  int n;
  cin >> n;
  vector <int> a(n), b(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
  }
  Frac ans(0, 1);
  {
    vector <int> p(n);
    iota(p.begin(), p.end(), 0);
    sort(p.begin(), p.end(), [&] (int i, int j) {
      return b[i] < b[j];
    });
    vector <int> na(n), nb(n);
    for (int i = 0; i < n; ++i) {
      na[i] = a[p[i]];
      nb[i] = b[p[i]];
    }
    a = na;
    b = nb;
  }
  vector <ll> can_suf(n);
  for (int i = n - 2; i >= 0; --i) {
    can_suf[i] = can_suf[i + 1] + max(0, b[i + 1] - a[i + 1]);
  }   
  auto check = [&] (int m) {
    multiset <int> best;
    ll sum_a = 0;
    bool fl = false;
    for (int i = 0; i < n; ++i) {
      if (i > 0) {
        best.insert(a[i - 1]);
        sum_a += a[i - 1];
        if ((int)best.size() == m + 1) {
          sum_a -= *best.rbegin();
          best.erase(--best.end());
        }
      }
      if (best.size() == m) {
        ll need = max(0LL, (sum_a + a[i]) - can_suf[i]);
        if (b[i] >= need) {
          fl = true;
          ll good = b[i] - need;
          Frac cur = Frac((ll)b[i] * m + good, (ll)b[i] * n);
          if (ans < cur) ans = cur;
        }
      }
    }
    return fl;
  };
  int l = 0, r = n;
  while (r - l > 1) {
    int m = (l + r) >> 1;
    if (check(m)) l = m;
    else r = m;
  }
  check(l);
  cout << ans.a << ' ' << ans.b << '\n';
}

