#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
void get(long long &a, long long &b) {
  long long d = gcd(a, b);
  a /= d, b /= d;
}
long long ans1, ans2;
void update(long long a, long long b) {
  get(a, b);
  if (1.0 * ans1 / ans2 < 1.0 * a / b) ans1 = a, ans2 = b;
}
struct node {
  int A, B, C;
  friend bool operator<(node a, node b) { return a.C < b.C; }
} a[MAXN + 5];
long long sum[MAXN + 5], SA;
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 1; i <= N; i++)
    scanf("%d%d", &a[i].A, &a[i].B), a[i].C = max(a[i].A, a[i].B);
  sort(a + 1, a + N + 1);
  for (int i = N; i >= 1; i--) sum[i] = sum[i + 1] + a[i].C, SA += a[i].A;
  ans1 = 0, ans2 = 1;
  for (int i = 1; i <= N; i++) {
    if (SA - (sum[1] - a[i].C) > a[i].B) continue;
    if (SA <= a[i].B) {
      update(1LL * N * a[i].B - SA, 1LL * N * a[i].B);
      continue;
    }
    int le = 1, ri = i - 1;
    while (le < ri) {
      int mid = (le + ri) >> 1;
      if (SA - (sum[mid] - a[i].C) >= 0)
        ri = mid;
      else
        le = mid + 1;
    }
    if (SA - (sum[le] - a[i].C) <= a[i].B && SA - (sum[le] - a[i].C) >= 0)
      update(1LL * le * a[i].B - (SA - (sum[le] - a[i].C)), 1LL * N * a[i].B);
    le = i + 1, ri = N;
    while (le < ri) {
      int mid = (le + ri) >> 1;
      if (SA - sum[mid] >= 0)
        ri = mid;
      else
        le = mid + 1;
    }
    if (SA - sum[le] <= a[i].B && SA - sum[le] >= 0)
      update(1LL * (le - 1) * a[i].B - (SA - sum[le]), 1LL * N * a[i].B);
  }
  printf("%lld %lld\n", ans1, ans2);
}
