#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long N;
long long A[101010], B[101010], As;
pair<long long, long long> BA[101010];
pair<long long, long long> abv[101010];
long long mk[101010], Sm[101010];
long long ansa, ansb;
long long i, j, k;
pair<long long, long long> solve(long long b, long long i) {
  long long l = 0, r = N;
  while (l < r) {
    long long c = (l + r + 1) / 2;
    long long a = Sm[c] - (c >= i + 1 ? abv[i].first : 0);
    if (a < As - b) {
      l = c;
    } else {
      r = c - 1;
    }
  }
  if (l == N) return {0l, 1l};
  ++l;
  long long a = As - Sm[l] + (l >= i + 1 ? abv[i].first : 0);
  if (a < 0) return {0l, 1l};
  return {(N - l + (l >= i + 1 ? 1 : 0)) * b - a, b};
}
int main() {
  scanf("%lld", &N);
  As = 0;
  for (i = 0; i < N; i++) {
    scanf("%lld%lld", &A[i], &B[i]);
    abv[i] = {max(A[i], B[i]), i};
    As += A[i];
  }
  if (N == 1) {
    if (A[0] >= B[0]) {
      printf("0 1");
    } else {
      j = gcd(A[0], B[0]);
      A[0] /= j;
      B[0] /= j;
      printf("%lld %lld", B[0] - A[0], B[0]);
    }
    return 0;
  }
  sort(abv, abv + N, greater<pair<long long, long long> >());
  for (i = 0; i < N; i++) {
    Sm[i + 1] = Sm[i] + abv[i].first;
  }
  ansa = 0;
  ansb = 1;
  for (i = 0; i < N; i++) {
    pair<long long, long long> a = solve(B[abv[i].second], i);
    if (ansa * a.second < ansb * a.first) {
      ansa = a.first;
      ansb = a.second;
    }
  }
  ansb *= N;
  j = gcd(ansa, ansb);
  ansa /= j;
  ansb /= j;
  printf("%lld %lld", ansa, ansb);
  return 0;
}
