#include <bits/stdc++.h>
int upll(const void* a, const void* b) {
  return *(long long*)a < *(long long*)b   ? -1
         : *(long long*)a > *(long long*)b ? 1
                                           : 0;
}
int downll(const void* a, const void* b) {
  return *(long long*)a < *(long long*)b   ? 1
         : *(long long*)a > *(long long*)b ? -1
                                           : 0;
}
void sortup(long long* a, int n) { qsort(a, n, sizeof(long long), upll); }
void sortdown(long long* a, int n) { qsort(a, n, sizeof(long long), downll); }
long long pom(long long a, long long n, int m) {
  long long x = 1;
  for (a %= m; n; n /= 2) n& 1 ? x = x * a % m : 0, a = a * a % m;
  return x;
}
long long gcd(long long p, long long q) {
  while (q) {
    long long t = p % q;
    p = q;
    q = t;
  }
  return p;
}
long long h[100010];
int PQhikaku(long long* heap, int i, int j) { return heap[i] < heap[j]; }
void heap_utod(long long* heap, int n) {
  if (2 * n > heap[0]) return;
  int rflag = (2 * n + 1 <= heap[0]) && (PQhikaku(heap, 2 * n, 2 * n + 1));
  if (PQhikaku(heap, n, 2 * n + rflag)) {
    long long temp = heap[2 * n + rflag];
    heap[2 * n + rflag] = heap[n];
    heap[n] = temp;
    heap_utod(heap, 2 * n + rflag);
  }
}
void heap_dtou(long long* heap, int n) {
  if (n == 1 || PQhikaku(heap, n, n / 2)) return;
  long long temp = heap[n];
  heap[n] = heap[n / 2];
  heap[n / 2] = temp;
  heap_dtou(heap, n / 2);
}
long long PQpop(long long* heap) {
  long long rr = heap[1];
  heap[1] = heap[heap[0]--];
  heap_utod(heap, 1);
  return rr;
}
void PQpush(long long* heap, long long n) {
  heap[++heap[0]] = n;
  heap_dtou(heap, heap[0]);
}
long long a[100010], b[100010], idx[100010];
int c1(const void* p, const void* q) {
  if (a[*(int*)p] - b[*(int*)p] < a[*(int*)q] - b[*(int*)q]) return -1;
  return 1;
}
int c2(const void* p, const void* q) {
  if (a[*(int*)p] < a[*(int*)q]) return -1;
  if (a[*(int*)p] > a[*(int*)q]) return 1;
  if (b[*(int*)p] > b[*(int*)q]) return -1;
  return 1;
}
int main() {
  long long n;
  scanf("%lld", &n);
  for (long long i = (0); i < (n); i++)
    scanf("%lld%lld", a + i, b + i), idx[i] = i;
  qsort(idx, n, sizeof(long long), c1);
  int cnt = 0;
  while (cnt < n && a[idx[cnt]] < b[idx[cnt]]) cnt++;
  if (cnt == 0) {
    puts("0 1");
    return 0;
  }
  qsort(idx + cnt, n - cnt, sizeof(long long), c2);
  for (long long i = (0); i < (cnt); i++) PQpush(h, b[idx[i]]);
  long long s = 0, pre;
  for (long long i = (0); i < (cnt); i++) {
    if (s < a[idx[i]]) s += pre = PQpop(h);
    s -= a[idx[i]];
  }
  for (long long i = (cnt); i < (n); i++) {
    if (s < a[idx[i]]) {
      PQpush(h, b[idx[i]]);
      long long nex = PQpop(h);
      long long ppre = pre;
      if (pre < nex) {
        long long t = pre;
        pre = nex;
        nex = t;
        s = pre - (nex - s);
      }
      if ((a[idx[i]] - s) * ppre + s * nex >= ppre * nex) break;
      s += nex - a[idx[i]];
      pre = nex;
    } else {
      PQpush(h, b[idx[i]]);
      s -= a[idx[i]];
    }
  }
  long long nume = h[0] * pre + s;
  long long deno = n * pre;
  long long d = gcd(nume, deno);
  printf("%lld %lld\n", nume / d, deno / d);
}
