#include <bits/stdc++.h>
using namespace std;
long long pla;
long long amari;
long long cou;
vector<pair<long long, long long> > small;
vector<pair<long long, long long> > large;
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
bool seica(long long now, bool flag) {
  long long tmp_amari = amari;
  long long tmp_cou = cou;
  while (tmp_cou < small.size() && now > 0) {
    long long tmp = min(now, small[tmp_cou].first - tmp_amari);
    now -= tmp;
    tmp_amari += tmp;
    if (tmp_amari == small[tmp_cou].first) {
      tmp_cou++;
      tmp_amari = 0;
    }
  }
  if (tmp_cou == small.size() && now > 0) {
    return false;
  }
  if (flag || cou == tmp_cou ||
      (tmp_cou == small.size() && cou == small.size() - 1) ||
      (tmp_amari * small[cou].first < amari * small[tmp_cou].first &&
       tmp_cou == cou + 1)) {
    cou = tmp_cou;
    amari = tmp_amari;
    return true;
  }
  return false;
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long sum_a = 0;
  for (long long(i) = (0); (i) < (n); ++i) {
    long long a, b;
    cin >> a >> b;
    if (a <= b) {
      small.emplace_back(b, a);
      sum_a += a;
    } else
      large.emplace_back(a, b);
  }
  sort(small.begin(), small.end(), greater<pair<long long, long long> >());
  sort(large.begin(), large.end());
  seica(sum_a, true);
  for (long long(i) = (0); (i) < (large.size()); ++i) {
    if (seica(large[i].first, false) == false) pla++;
  }
  long long p, q;
  if (amari) {
    p = n * small[cou].first - small[cou].first * (pla + cou) - amari;
    q = n * small[cou].first;
    long long gcd_num = gcd(p, q);
    p /= gcd_num;
    q /= gcd_num;
  } else {
    p = n - (pla + cou);
    q = n;
    long long gcd_num = gcd(p, q);
    p /= gcd_num;
    q /= gcd_num;
  }
  cout << p << " " << q << endl;
  return 0;
}
