#include <bits/stdc++.h>

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

struct Item {
  int64 a, b;
  Item(int64 a, int64 b) : a(a), b(b) {}
};

int64 GCD(int64 a, int64 b) {
  if (a < b) return GCD(b, a);
  int64 r = a % b;
  if (r == 0) return b;
  else return GCD(b, r);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n;
  cin >> n;
  vector<Item> items;
  int64 a_sum = 0;
  for (int i = 0; i < n; i++) {
    int64 a, b;
    cin >> a >> b;
    items.emplace_back(a, b);
    a_sum += a;
  }
  sort(items.begin(), items.end(), [](const Item& item1, const Item& item2) {
    return max(item1.a, item1.b) > max(item2.a, item2.b);
  });

  int64 t_sum = 0;
  int64 t_count = 0;
  for (int i = 0; i < n; i++) {
    t_sum += max(items[i].a, items[i].b);
    t_count++;
    if (t_sum >= a_sum) break;
  }

  if (DEBUG) cout << "t_sum: " << t_sum << endl;
  if (DEBUG) cout << "t_count: " << t_count << endl;

  int64 max_num = 0;
  int64 max_den = 1;
  for (int i = 0; i < n; i++) {
    if (i < t_count) {
      if (t_sum - max(items[i].a, items[i].b) + items[i].b >= a_sum) {
        int64 r = a_sum - (t_sum - max(items[i].a, items[i].b));
        int64 num = items[i].b - r;
        int64 den = items[i].b;
        if (num * max_den > max_num * den) {
          max_num = num;
          max_den = den;
        }
      }
    } else {
      if (t_sum - max(items[t_count - 1].a, items[t_count - 1].b) + items[i].b
              >= a_sum) {
        int64 r =
            a_sum - (t_sum - max(items[t_count - 1].a, items[t_count - 1].b));
        int64 num = items[i].b - r;
        int64 den = items[i].b;
        if (num * max_den > max_num * den) {
          max_num = num;
          max_den = den;
        }
      }
    }
  }

  if (DEBUG) cout << "max_num: " << max_num << endl;
  if (DEBUG) cout << "max_den: " << max_den << endl;

  int64 ans_num = (n - (t_count)) * max_den + max_num;
  int64 ans_den = n * max_den;
  if (ans_num == 0) ans_den = 1;
  else {
    int64 d = GCD(ans_num, ans_den);
    ans_num /= d;
    ans_den /= d;
  }
  cout << ans_num << " " << ans_den << endl;
}