#include <bits/stdc++.h>
using namespace std;
using Pi = pair<int, int>;
int N;
vector<int> A, B;
int main() {
  long long ans1 = 0, ans2 = 1;
  cin >> N;
  A = vector<int>(N);
  B = vector<int>(N);
  vector<Pi> T(0);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    cin >> B[i];
    T.push_back(make_pair(A[i], B[i]));
  }
  sort(T.begin(), T.end(), [](Pi const& l, Pi const& r) {
    bool lt = l.first < l.second;
    bool rt = r.first < r.second;
    if (lt != rt) {
      return lt;
    }
    if (lt) {
      return l.second > r.second;
    }
    return l.first < r.first;
  });
  int plus_boder = -1;
  long long sum = 0;
  for (int i = 0; i < N; i++) {
    int dif = T[i].second - T[i].first;
    if (dif >= 0) {
      sum += dif;
    } else {
      if (plus_boder == -1) {
        plus_boder = i - 1;
      }
      sum -= T[i].first;
      if (sum < 0) {
        sum += T[i].first;
        break;
      }
    }
  }
  while (plus_boder >= 0) {
    if (sum > T[plus_boder].second) {
      sum -= T[plus_boder].second;
      plus_boder--;
    } else {
      ans1 = sum + plus_boder * (long long)T[plus_boder].second;
      ans2 = T[plus_boder].second * (long long)N;
      break;
    }
  }
  for (long long i = 2; i * i <= ans1; i++) {
    while (ans1 % i == 0 && ans2 % i == 0) {
      ans1 /= i;
      ans2 /= i;
    }
  }
  if (ans1 != 0 && ans2 % ans1 == 0) {
    ans2 /= ans1;
    ans1 = 1;
  }
  cout << ans1 << " " << ans2 << endl;
  return 0;
}
