#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
const ll INF = (1e+18) + 100;
const ll mod = 1000000007;
const long double eps = 1e-8;
ll gcd(ll a, ll b) {
  if (a < b) swap(a, b);
  while (b) {
    ll r = a % b;
    a = b;
    b = r;
  }
  return a;
}
bool isl(pair<ll, LP> a, pair<ll, LP> b) {
  if (a.first != b.first) return a.first < b.first;
  return a.second.first * b.second.second < a.second.second * b.second.first;
}
void solve() {
  int n;
  cin >> n;
  vector<ll> bs;
  ll sum = 0;
  vector<LP> w;
  for (int i = 0; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    if (a <= b) {
      sum += a;
      bs.push_back(b);
    } else {
      w.push_back({a, b});
    }
  }
  sort(bs.begin(), bs.end(), greater<ll>());
  vector<ll> rb(bs.size() + 1);
  for (int i = 0; i < bs.size(); ++i) {
    rb[i + 1] = rb[i] + bs[i];
  }
  if (bs.size() == 0) {
    cout << "0 1" << endl;
    return;
  }
  sort(w.begin(), w.end());
  if (w.size() == 0) {
    assert(false);
    int id = upper_bound(rb.begin(), rb.end(), sum) - rb.begin();
    id--;
    ll rest = sum - rb[id];
    pair<ll, LP> memo = {bs.size() - id - 1, {rest, bs[id]}};
    LP ans = {memo.second.first + memo.first * memo.second.second,
              memo.second.second};
    ans.second *= n;
    ll g = gcd(ans.first, ans.second);
    ans.first /= g;
    ans.second /= g;
    cout << ans.first << " " << ans.second << endl;
    return;
  } else if (w.size() == 1) {
    ll suma = sum;
    int id = upper_bound(rb.begin(), rb.end(), suma) - rb.begin();
    id--;
    ll rest = suma - rb[id];
    pair<ll, LP> z1 = {bs.size() - id - 1, {rest, bs[id]}};
    suma = sum + w[0].first;
    pair<ll, LP> z2;
    if (suma >= rb[bs.size()] + w[0].second) {
      z2 = {0, {0, 1}};
    } else {
      id = lower_bound(rb.begin(), rb.end(), suma - (w[0].second - 1)) -
           rb.begin();
      rest = suma - rb[id];
      if (rest < 0) {
        id = upper_bound(rb.begin(), rb.end(), suma) - rb.begin();
        id--;
        z2.first = 1 + bs.size() - id - 1;
        ll rest = suma - rb[id];
        z2.second = {bs[id] - rest, bs[id]};
      } else {
        z2.first = 1 + bs.size() - id;
        z2.second = {w[0].second - rest, w[0].second};
      }
    }
    LP ans;
    if (isl(z1, z2)) {
      ans = {z2.second.first + z2.first * z2.second.second, z2.second.second};
    } else {
      ans = {z1.second.first + z1.first * z1.second.second, z1.second.second};
    }
    ans.second *= n;
    ll g = gcd(ans.first, ans.second);
    ans.first /= g;
    ans.second /= g;
    cout << ans.first << " " << ans.second << endl;
    return;
  }
  ll suma = sum;
  int id = upper_bound(rb.begin(), rb.end(), suma) - rb.begin();
  id--;
  ll rest = suma - rb[id];
  pair<ll, LP> memo = {bs.size() - id - 1, {rest, bs[id]}};
  vector<ll> rw(w.size() + 1);
  for (int i = 0; i < w.size(); ++i) {
    rw[i + 1] = rw[i] + w[i].first;
  }
  for (int i = 0; i < w.size(); ++i) {
    int le = -1, ri = w.size() - 2;
    while (ri - le > 1) {
      int m = (le + ri) / 2;
      ll suma = sum + rw[m] + w[i].first;
      if (i < m) {
        suma -= w[i].first;
        suma += w[m].first;
      }
      if (suma >= w[i].second + rb[bs.size()]) {
        ri = m;
        continue;
      }
      pair<ll, LP> c1, c2;
      id = lower_bound(rb.begin(), rb.end(), suma - (w[i].second - 1)) -
           rb.begin();
      rest = suma - rb[id];
      if (rest < 0) {
        id = upper_bound(rb.begin(), rb.end(), suma) - rb.begin();
        id--;
        c1.first = m + 1 + bs.size() - id - 1;
        ll rest = suma - rb[id];
        c1.second = {bs[id] - rest, bs[id]};
      } else {
        c1.first = m + 1 + bs.size() - id - 1;
        c1.second = {w[i].second - rest, w[i].second};
      }
      suma = sum + rw[m + 1] + w[i].first;
      if (i < m + 1) {
        suma -= w[i].first;
        suma += w[m + 1].first;
      }
      if (suma >= w[i].second + rb[bs.size()]) {
        ri = m;
        continue;
      }
      id = lower_bound(rb.begin(), rb.end(), suma - (w[i].second - 1)) -
           rb.begin();
      rest = suma - rb[id];
      if (rest < 0) {
        id = upper_bound(rb.begin(), rb.end(), suma) - rb.begin();
        id--;
        c2.first = m + 1 + 1 + bs.size() - id - 1;
        ll rest = suma - rb[id];
        c2.second = {bs[id] - rest, bs[id]};
      } else {
        c2.first = m + 1 + 1 + bs.size() - id - 1;
        c2.second = {w[i].second - rest, w[i].second};
      }
      if (isl(c1, c2)) {
        le = m;
      } else {
        ri = m;
      }
    }
    ll suma = sum + rw[ri] + w[i].first;
    if (i < ri) {
      suma -= w[i].first;
      suma += w[ri].first;
    }
    if (suma < w[i].second + rb[bs.size()]) {
      id = lower_bound(rb.begin(), rb.end(), suma - (w[i].second - 1)) -
           rb.begin();
      pair<ll, LP> z;
      rest = suma - rb[id];
      if (rest < 0) {
        id = upper_bound(rb.begin(), rb.end(), suma) - rb.begin();
        id--;
        z.first = ri + 1 + bs.size() - id - 1;
        ll rest = suma - rb[id];
        z.second = {bs[id] - rest, bs[id]};
      } else {
        z.first = ri + 1 + bs.size() - id - 1;
        z.second = {w[i].second - rest, w[i].second};
      }
      if (isl(memo, z)) {
        memo = z;
      }
    }
    ri = 0;
    suma = sum + rw[ri] + w[i].first;
    if (i < ri) {
      suma -= w[i].first;
      suma += w[ri].first;
    }
    if (suma >= w[i].second + rb[bs.size()]) continue;
    id = lower_bound(rb.begin(), rb.end(), suma - (w[i].second - 1)) -
         rb.begin();
    pair<ll, LP> z;
    rest = suma - rb[id];
    if (rest < 0) {
      id = upper_bound(rb.begin(), rb.end(), suma) - rb.begin();
      id--;
      z.first = ri + 1 + bs.size() - id - 1;
      ll rest = suma - rb[id];
      z.second = {bs[id] - rest, bs[id]};
    } else {
      z.first = ri + 1 + bs.size() - id - 1;
      z.second = {w[i].second - rest, w[i].second};
    }
    if (isl(memo, z)) {
      memo = z;
    }
  }
  LP ans = {memo.second.first + memo.first * memo.second.second,
            memo.second.second};
  ans.second *= n;
  ll g = gcd(ans.first, ans.second);
  ans.first /= g;
  ans.second /= g;
  cout << ans.first << " " << ans.second << endl;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
