#include <bits/stdc++.h>
using namespace std;
using cat = long long;
cat gcd(cat x, cat y) {
  if (x > y) swap(x, y);
  return (x == 0) ? y : gcd(y % x, x);
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  vector<int> near;
  vector<pair<int, int> > far;
  cat A_sum = 0;
  cat BA_dif = 0;
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    if (a <= b) {
      near.push_back(b);
      A_sum += a;
      BA_dif += b - a;
    } else
      far.push_back({a, b});
  }
  sort(begin(near), end(near));
  reverse(begin(near), end(near));
  sort(begin(far), end(far));
  cat ans_num = 0, ans_denom = 1;
  cat B_sum = 0;
  for (int f = 0, d = 0; f <= (int)far.size(); f++) {
    while (d < (int)near.size() && near[d] + B_sum < A_sum) {
      B_sum += near[d];
      d++;
    }
    if (d == (int)near.size()) break;
    cat P_num = 1LL * near[d] * (near.size() + f - d) - (A_sum - B_sum);
    cat P_denom = near[d];
    cat g = gcd(P_num, P_denom);
    P_num /= g, P_denom /= g;
    cat P = P_num / P_denom;
    cat ans = ans_num / ans_denom;
    if (P > ans)
      ans_num = P_num, ans_denom = P_denom;
    else if (P == ans) {
      cat dif = (P_num % P_denom) * ans_denom - (ans_num % ans_denom) * P_denom;
      if (dif > 0) ans_num = P_num, ans_denom = P_denom;
    }
    if (f < (int)far.size()) A_sum += far[f].first;
  }
  int max_cnt = 0;
  cat A_sum_max_cnt = 0;
  if (!near.empty())
    for (int i = 0; i < (int)far.size(); i++) {
      cat dif = BA_dif + far[i].second - far[i].first;
      if (dif < 0) continue;
      int cnt = max_cnt;
      cat A_sum_cnt = A_sum_max_cnt;
      if (i < max_cnt) {
        A_sum_cnt -= far[i].first;
        A_sum_cnt += far[cnt++].first;
      }
      if (A_sum_cnt > dif) continue;
      while (cnt < (int)far.size()) {
        if (cnt != i) {
          if (A_sum_cnt + far[cnt].first > dif) break;
          A_sum_cnt += far[cnt].first;
        }
        cnt++;
      }
      while (max_cnt < cnt - (i < cnt)) {
        A_sum_max_cnt += far[max_cnt].first;
        max_cnt++;
      }
      if (A_sum_cnt - BA_dif + far[i].first < 0) continue;
      cat P_num = 1LL * far[i].second * (cnt - (i < cnt)) + (dif - A_sum_cnt),
          P_denom = far[i].second;
      cat g = gcd(P_num, P_denom);
      P_num /= g, P_denom /= g;
      cat P = P_num / P_denom;
      cat ans = ans_num / ans_denom;
      if (P > ans)
        ans_num = P_num, ans_denom = P_denom;
      else if (P == ans) {
        dif = (P_num % P_denom) * ans_denom - (ans_num % ans_denom) * P_denom;
        if (dif > 0) ans_num = P_num, ans_denom = P_denom;
      }
    }
  cat g = gcd(ans_num, ans_denom * N);
  cout << ans_num / g << " " << ans_denom * N / g << "\n";
  return 0;
}
