#include <bits/stdc++.h>
using namespace std;
int n;
long long gcd(long long a, long long b) {
  long long c = a % b;
  while (c) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}
int main() {
  scanf("%d", &n);
  long long suma = 0;
  vector<int> as, bs;
  for (int i = 0; i < n; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    if (a > b) {
      as.push_back(a);
    } else {
      suma += a;
      bs.push_back(b);
    }
  }
  sort(bs.begin(), bs.end());
  reverse(bs.begin(), bs.end());
  sort(as.begin(), as.end());
  for (int i = 0, j = 0; i < (int)bs.size(); ++i) {
    if (suma > bs[i]) {
      suma -= bs[i];
    } else {
      bool terminate = true;
      if (j < (int)as.size()) {
        if (suma + as[j] <= bs[i]) {
          terminate = false;
        } else {
          if (i + 1 < (int)bs.size() && suma + as[j] - bs[i] <= bs[i + 1]) {
            int left = suma + as[j] - bs[i];
            if ((long long)left * bs[i] < (long long)suma * bs[i + 1]) {
              terminate = false;
            }
          }
        }
      }
      if (terminate) {
        long long left = bs.size() - i + j, q = bs[i], p = q * left - suma;
        q *= n;
        long long g = gcd(p, q);
        p /= g, q /= g;
        cout << p << ' ' << q << endl;
        return 0;
      } else {
        suma += as[j];
        ++j;
        --i;
      }
    }
  }
  printf("0 1\n");
  return 0;
}
