#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return a == 0 ? b : gcd(b % a, a); }
struct frac {
  long long a, b, m = 0;
  frac(long long aa, long long bb) : a(aa), b(bb) {
    long long g = gcd(a, b);
    if (g == 0) g = 1;
    a /= g, b /= g;
    if (b < 0) a *= -1, b *= -1;
  }
  frac(long long a, long long b, long long mm) : frac(a, b) { m = mm; }
  bool operator<(frac& o) {
    if (m != o.m) return m < o.m;
    return a * o.b < o.a * b;
  }
  frac operator/(long long n) { return frac(a + m * b, b * n); }
};
int n;
long long p[200000];
pair<long long, long long> d[200000];
bool cmp(pair<long long, long long> pa, pair<long long, long long> pb) {
  return 2 * pa.first + pb.second < 2 * pb.first + pa.second;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  cin >> n;
  int a, b;
  for (int i = 0; i < n; i++) cin >> a >> b, d[i] = {a - b, a};
  sort(d, d + n, cmp);
  int pos = -1;
  for (int i = 0; i < n && d[i].first < 0; i++)
    p[i + 1] = -d[i].first + p[i], pos = i;
  long long t = 0, m = 0;
  set<long long> ut;
  for (int i = n - 1; i > pos; i--) {
    ut.insert(d[i].second);
    t += d[i].second;
    m++;
  }
  frac opt(0, 1);
  for (int i = pos; i >= 0; i--) {
    while (m > 0 && t > p[i + 1]) {
      auto it = ut.end();
      it--;
      long long v = *(it);
      t -= v;
      m--;
      ut.erase(it);
    }
    a = -d[i].first;
    b = d[i].second;
    while (m > 0 && t > p[i]) {
      frac here(p[i] - t + a, a + b, m);
      if (opt < here) opt = here;
      auto it = ut.end();
      it--;
      long long v = *(it);
      t -= v;
      m--;
      ut.erase(it);
    }
    frac here(p[i] - t + a, a + b, m);
    frac herem(1, 1, m);
    if (herem < here) swap(here, herem);
    if (opt < here) opt = here;
    ut.insert(d[i].second);
    t += d[i].second;
    m++;
  }
  opt = opt / n;
  cout << opt.a << " " << opt.b << "\n";
}
