#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
using namespace std;
const long long maxn = 1e6;
long long n, m, k, t;
vector<pair<long long, long long> > A;
vector<long long> S;
long long C[maxn];
long long gcd(long long a, long long b) {
  while (a != 0) {
    b = b % a;
    swap(a, b);
  }
  return b;
}
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  return max(a.first, a.second) > max(b.first, b.second);
}
void minmin(pair<long long, long long> &a, pair<long long, long long> b) {
  if (a.first * 1.0 / a.second > b.first * 1.0 / b.second) {
    a = b;
  }
}
pair<long long, long long> getsum(pair<long long, long long> s1,
                                  pair<long long, long long> s2) {
  long long lc = s1.second * s2.second / gcd(abs(s1.second), abs(s2.second));
  return make_pair(s1.first * (lc / s1.second) + s2.first * (lc / s2.second),
                   lc);
}
inline void ease(pair<long long, long long> &p) {
  long long g = gcd(p.first, p.second);
  p.first /= g;
  p.second /= g;
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long q, w, e, a, b, c;
  cin >> n;
  long long sum = 0;
  for (q = 0; q < n; q++) {
    cin >> a >> b;
    sum += a;
    A.push_back(make_pair(a, b));
  }
  sort(A.begin(), A.end(), cmp);
  S.resize(n);
  S[0] = max(A[0].first, A[0].second);
  for (q = 1; q < n; q++) {
    S[q] = S[q - 1] + max(A[q].first, A[q].second);
  }
  pair<long long, long long> ans = make_pair(1, 1);
  for (q = 0; q < n; q++) {
    if (q != 4 && q != 6) {
      continue;
    }
    long long d1 = max(A[q].second, A[q].first);
    long long i = lower_bound(S.begin(), S.end(), sum - d1) - S.begin();
    long long cnt = i + 1;
    long long t = S[i];
    long long d = max(A[q].first, A[q].second);
    if (i >= q) {
      i = lower_bound(S.begin(), S.end(), sum - d1 + d) - S.begin();
      t = S[i] - d;
    }
    if (i >= n) {
      continue;
    }
    pair<long long, long long> zhopa =
        make_pair(t - sum + A[q].second, A[q].second);
    zhopa.first *= -1;
    zhopa = getsum(make_pair(1, 1), zhopa);
    zhopa.second *= n;
    ease(zhopa);
    if (t - sum + A[q].second > A[q].second) {
      continue;
    }
    pair<long long, long long> dans = getsum(zhopa, make_pair(cnt, n));
    ease(dans);
    minmin(ans, dans);
  }
  ans.first = ans.second - ans.first;
  ease(ans);
  cout << ans.first << " " << ans.second;
  return 0;
}
