#include <bits/stdc++.h>
std::mt19937 rng(
    (int)std::chrono::steady_clock::now().time_since_epoch().count());
long long gcd(long long a, long long b) { return b == 0LL ? a : gcd(b, a % b); }
struct Fraction {
  long long p, q;
  long long extra;
  Fraction(long long a = 0, long long b = 1) {
    p = a, q = b;
    extra = a / b;
    p %= q;
    fix();
  }
  void fix() {
    long long g = gcd(p, q);
    p /= g;
    q /= g;
  }
  bool operator>(Fraction o) const {
    return extra != o.extra ? extra > o.extra : p * o.q > q * o.p;
  }
};
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  int n;
  std::cin >> n;
  std::vector<std::pair<int, int>> segs, bad;
  long long sumA = 0, sumB = 0;
  for (int i = 0; i < n; i++) {
    int a, b;
    std::cin >> a >> b;
    if (a < b) {
      segs.emplace_back(a, b);
      sumA += a;
      sumB += b;
    } else {
      bad.emplace_back(a, b);
    }
  }
  std::sort(segs.rbegin(), segs.rend(),
            [&](std::pair<int, int> v1, std::pair<int, int> v2) {
              return v1.second > v2.second;
              return (long long)v1.first * v2.second >
                     (long long)v1.second * v2.first;
            });
  std::sort(bad.begin(), bad.end(),
            [&](std::pair<int, int> v1, std::pair<int, int> v2) {
              return v1.first > v2.first;
            });
  int ori = n;
  Fraction ans;
  n = (int)segs.size();
  if (n) {
    int on = 0;
    while (sumB - segs[on].second >= sumA) {
      sumB -= segs[on++].second;
    }
    auto seg = segs[on];
    long long p = (long long)on * seg.second + (sumB - sumA);
    long long q = (long long)seg.second;
    ans = Fraction(p, q);
    int extra = 0;
    while (!bad.empty()) {
      sumA += bad.back().first;
      bad.pop_back();
      extra++;
      while (on > 0 && sumB <= sumA) {
        sumB += segs[--on].second;
      }
      if (sumB <= sumA) {
        break;
      }
      seg = segs[on];
      p = (long long)(on + extra) * seg.second + (sumB - sumA);
      q = (long long)seg.second;
      Fraction wtf(p, q);
      if (wtf > ans) {
        ans = wtf;
      }
    }
  }
  ans = Fraction(ans.p + ans.extra * ans.q, ans.q * ori);
  std::cout << ans.p << ' ' << ans.q << '\n';
}
