#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
int main() {
  int N;
  cin >> N;
  vector<long long> A(N), B(N);
  vector<int> p(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i] >> B[i];
    p[i] = i;
  }
  sort(p.begin(), p.end(), [&](int i, int j) {
    long long pa = A[i] + max(B[i] - A[i], 0LL);
    long long pb = A[j] + max(B[j] - A[j], 0LL);
    return pa < pb;
  });
  long long sum = 0;
  for (int i = 0; i < N; ++i) {
    sum += max(B[i] - A[i], 0LL);
  }
  long long P = -1, Q = -1;
  int cnt = 0;
  for (int i : p) {
    long long val = A[i] + max(B[i] - A[i], 0LL);
    if (sum >= val)
      sum -= val;
    else {
      P = cnt * val + sum;
      Q = val * N;
      break;
    }
    ++cnt;
  }
  long long g = gcd(P, Q);
  P /= g;
  Q /= g;
  cout << P << ' ' << Q << endl;
  return 0;
}
