#include <bits/stdc++.h>
using namespace std;
int n, a[111111], b[111111], cnt, mx, nw;
pair<int, int> arr[111111];
long long sum, fuck, x, y, d, pp;
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
struct frac {
  long long x, y;
  bool operator<(const frac &u) const { return (x * u.y < y * u.x); }
  bool operator>(const frac &u) const { return (x * u.y > y * u.x); }
} cur, ass;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i], &b[i]);
    sum += a[i];
  }
  for (int i = 1; i <= n; i++) {
    arr[i] = make_pair(max(a[i], b[i]), i);
  }
  sort(arr + 1, arr + n + 1);
  reverse(arr + 1, arr + n + 1);
  for (int i = 1; i <= n; i++) {
    fuck += arr[i].first;
    if (fuck >= sum) {
      cnt = i;
      break;
    }
  }
  x = n - cnt;
  y = n;
  d = gcd(x, y);
  x /= d;
  y /= d;
  cur.x = x;
  cur.y = y;
  mx = -1e9;
  for (int i = cnt + 1; i <= n; i++) mx = max(mx, b[arr[i].second]);
  for (int i = 1; i <= cnt; i++) {
    nw = max(mx, b[arr[i].second]);
    pp = max(0ll, sum - fuck + arr[i].first);
    if (pp >= nw) continue;
    x = 1ll * nw * (n - cnt) + nw - pp;
    y = 1ll * nw * n;
    d = gcd(x, y);
    x /= d;
    y /= d;
    ass.x = x;
    ass.y = y;
    if (ass > cur) cur = ass;
  }
  printf("%lld %lld\n", cur.x, cur.y);
  return 0;
}
