#include <bits/stdc++.h>
using namespace std;
long long n;
long long a[100005], b[100005];
pair<long long, long long> p[100005];
long long pos[100005], sum[100005], S;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
pair<long long, long long> getmax(pair<long long, long long> p,
                                  pair<long long, long long> q) {
  if (p.first / p.second < q.first / q.second) return q;
  if (p.first / p.second > q.first / q.second) return p;
  p.first %= p.second, q.first %= q.second;
  if (p.first * q.second <= q.first * p.second)
    return q;
  else
    return p;
}
pair<long long, long long> reduce(pair<long long, long long> p) {
  if (p.first == 0) return pair<long long, long long>(0, 1);
  long long g = gcd(p.first, p.second);
  p.first /= g, p.second /= g;
  return p;
}
pair<long long, long long> calc(long long i) {
  long long ub = n, lb = -1, mid;
  while (ub - lb > 1) {
    mid = (ub + lb) / 2;
    long long tmp = sum[mid];
    if (i <= mid) tmp -= p[i].first;
    if (tmp >= S - b[p[i].second])
      ub = mid;
    else
      lb = mid;
  }
  long long tmp = sum[ub];
  if (i <= ub) tmp -= p[i].first, ub--;
  if (tmp > S) return pair<long long, long long>(0, 1);
  long long x = n - ub, y = S - tmp;
  pair<long long, long long> ret = reduce(
      pair<long long, long long>(b[p[i].second] * x - y, b[p[i].second]));
  return ret;
}
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    p[i] = pair<long long, long long>(max(a[i], b[i]), i);
  }
  sort(p + 1, p + n + 1);
  reverse(p + 1, p + n + 1);
  for (int i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + p[i].first;
    S += a[i];
  }
  pair<long long, long long> ans = pair<long long, long long>(0, 1);
  for (int i = 1; i <= n; i++) ans = getmax(ans, calc(i));
  ans.second *= n;
  ans = reduce(ans);
  cout << ans.first << " " << ans.second << endl;
  return 0;
}
