#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
T gcd(T n, T m) {
  if (n > m)
    return gcd(m, n);
  else if (n == 0)
    return m;
  else
    return gcd(m - n * (m / n), n);
}
struct rat {
  ll p, q;
  rat(ll p_ = 0, ll q_ = 1) {
    ll k = gcd(abs(p_), abs(q_));
    p = (p_ / k) * (q_ / abs(q_));
    q = abs(q_) / k;
  }
  bool operator==(const rat& x) { return p == x.p && q == x.q; }
  bool operator<(const rat& x) { return p * x.q < x.p * q; }
  bool operator>(const rat& x) { return p * x.q > x.p * q; }
  rat& operator=(const rat& x) {
    p = x.p;
    q = x.q;
    return *this;
  }
  rat operator+(const rat& x) {
    rat y(p * x.q + x.p * q, q * x.q);
    return y;
  }
  rat operator-(const rat& x) {
    rat y(p * x.q - x.p * q, q * x.q);
    return y;
  }
  rat operator*(const rat& x) {
    rat y(p * x.p, q * x.q);
    return y;
  }
  rat operator/(const rat& x) {
    rat y(p * x.q, q * x.p);
    return y;
  }
  rat& operator+=(const rat& x) {
    *this = *this + x;
    return *this;
  }
  rat& operator-=(const rat& x) {
    *this = *this - x;
    return *this;
  }
  rat& operator*=(const rat& x) {
    *this = *this * x;
    return *this;
  }
  rat& operator/=(const rat& x) {
    *this = *this / x;
    return *this;
  }
};
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  istream& in(cin);
  ostream& out(cout);
  ll s = 0, ns;
  int n, a, b, k = 0;
  multiset<int> ms;
  vector<pair<int, int>> ab;
  in >> n;
  for (int i = 0; i < (n); ++i) {
    in >> a >> b;
    if (a <= b) {
      s += a;
      ms.insert(b);
      ++k;
    } else
      ab.emplace_back(a, b);
  }
  sort(ab.begin(), ab.end());
  while (!ms.empty() && *ms.rbegin() <= s) {
    s -= *ms.rbegin();
    --k;
    auto it = ms.end();
    ms.erase(--it);
  }
  if (ms.empty()) {
    cout << 0 << " " << 1 << endl;
    return 0;
  }
  using ld = long double;
  ld x = s / (ld)*ms.rbegin(), nx;
  for (auto p : ab) {
    if (p.second >= *ms.rbegin()) {
      ns = s - p.second + p.first;
    } else {
      ns = s + p.first;
      ms.emplace(p.second);
    }
    if (ns < *ms.rbegin()) {
      ++k;
      s = ns;
      x = s / (ld)*ms.rbegin();
      continue;
    }
    auto it = ms.end();
    --it;
    ns -= *it;
    if (it == ms.begin()) continue;
    --it;
    nx = ns / (ld)*ms.rbegin();
    if (nx < x) {
      x = nx;
      s = ns;
      ++it;
      ms.erase(it);
    }
  }
  rat R((ll)k * *ms.rbegin() - s, (ll)*ms.rbegin() * n);
  cout << R.p << " " << R.q << endl;
}
