#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
int stack[20];
inline void write(int x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (!x) {
    putchar('0');
    return;
  }
  int top = 0;
  while (x) stack[++top] = x % 10, x /= 10;
  while (top) putchar(stack[top--] + '0');
}
inline void pr1(int x) { write(x), putchar(' '); }
inline void pr2(int x) { write(x), puts(""); }
int cnt, tot, a[100010], b[100010];
long long s[100010];
inline int erfen(long long x) {
  int l = 0, r = tot, p = -1;
  while (l <= r) {
    int mid = l + r >> 1;
    if (s[mid] <= x)
      p = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  return p;
}
inline long long gcd(long long x, long long y) {
  if (x == 0)
    return y;
  else
    return gcd(y % x, x);
}
int main() {
  int n = read();
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    int x = read(), y = read();
    if (x > y)
      a[++cnt] = x;
    else
      sum += y - x, b[++tot] = y;
  }
  sort(a + 1, a + cnt + 1), sort(b + 1, b + tot + 1);
  for (int i = 1; i <= tot; i++) s[i] = s[i - 1] + b[i];
  long long ax = 0, ay = 1, w = 0;
  for (int i = 0; i <= cnt; i++) {
    w += a[i];
    int uf = erfen(sum - w);
    if (uf == -1) continue;
    long long x = 1LL * (uf + i) * b[uf + 1] + sum - s[uf] - w,
              y = 1LL * b[uf + 1] * n, ul = gcd(x, y);
    if (x == 0) continue;
    x /= ul, y /= ul;
    long long he = gcd(ay, y);
    if (ay / he * x > y / he * ax) ax = x, ay = y;
  }
  printf("%lld %lld\n", ax, ay);
  return 0;
}
