#include <bits/stdc++.h>
using namespace std;
mt19937 mrand(random_device{}());
const long long mod = 1000000007;
int rnd(int x) { return mrand() % x; }
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
const int N = 101000;
int a[N], b[N], n, bad[N];
long long s;
vector<pair<int, int> > r;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", a + i, b + i);
    if (b[i] >= a[i])
      s += b[i] - a[i];
    else
      bad[i] = a[i] - b[i];
    r.push_back(make_pair(max(a[i], b[i]), i));
  }
  sort((r).begin(), (r).end());
  int c = 0;
  long long z = 0;
  pair<long long, long long> ans(0, 1);
  for (int i = 0; i < ((int)(r).size()); i++) {
    if (s >= r[i].first)
      s -= r[i].first, c++;
    else {
      if (s >= bad[r[i].second]) {
        long long ca = s - bad[r[i].second], cb = b[r[i].second];
        if (ans.first * cb < ans.second * ca) ans = make_pair(ca, cb);
      }
    }
  }
  ans.first = ans.first + c * ans.second;
  ans.second *= n;
  long long d = gcd(ans.first, ans.second);
  printf("%lld %lld\n", ans.first / d, ans.second / d);
}
