#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
const int mod = 998244353;
const long long int big = 2.19e15 + 1;
const long double pai = 3.141592653589793238462643383279502884197;
const long double eps = 1e-10;
template <class T, class U>
bool mineq(T& a, U b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T, class U>
bool maxeq(T& a, U b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
long long int gcd(long long int a, long long int b) {
  if (a % b == 0) {
    return b;
  } else
    return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  if (a == 0) {
    return b;
  }
  return a / gcd(a, b) * b;
}
template <class T>
void SO(T& ve) {
  sort(ve.begin(), ve.end());
}
template <class T>
void REV(T& ve) {
  reverse(ve.begin(), ve.end());
}
template <class T>
long long int LBI(const vector<T>& ar, T in) {
  return lower_bound(ar.begin(), ar.end(), in) - ar.begin();
}
template <class T>
long long int UBI(const vector<T>& ar, T in) {
  return upper_bound(ar.begin(), ar.end(), in) - ar.begin();
}
int main(void) {
  cout << fixed << setprecision(20);
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, i;
  cin >> n;
  long long int At = 0, ans = 0;
  vector<long long int> Swin;
  vector<long long int> Rwin;
  for (i = 0; i < n; i++) {
    long long int A, B;
    cin >> A >> B;
    if (A < B) {
      At += A;
      Swin.push_back(B);
      ans++;
    } else {
      Rwin.push_back(A);
    }
  }
  Swin.push_back(0);
  SO(Swin);
  SO(Rwin);
  while (Swin.size() > 1 && At >= Swin.back()) {
    ans--;
    At -= Swin.back();
    Swin.pop_back();
  }
  for (auto it : Rwin) {
    if (At + it < Swin.back()) {
      ans++;
      At += it;
    } else if (Swin.size() > 1) {
      auto aaa = At * Swin[Swin.size() - 2];
      auto bbb = (At + it - Swin.back()) * Swin.back();
      if (aaa > bbb) {
        At += it - Swin.back();
        Swin.pop_back();
      } else {
        break;
      }
    }
  }
  long long int P = ans * Swin.back() - At, Q = Swin.back() * n;
  if (Q == 0) {
    cout << "0 1" << endl;
    return 0;
  }
  long long int G = gcd(P, Q);
  cout << P / G << " " << Q / G << endl;
  return 0;
}
