#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  while (b > 0) {
    long long int c = a % b;
    a = b;
    b = c;
  }
  return a;
}
struct seg {
  long long int a, b;
};
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<seg> s(n);
  for (int i = 0; i < n; i++) {
    cin >> s[i].a >> s[i].b;
  }
  vector<seg> plus;
  vector<seg> minus;
  long long int dif = 0;
  for (int i = 0; i < n; i++) {
    if (s[i].b > s[i].a) {
      plus.push_back(s[i]);
      dif += s[i].b - s[i].a;
    } else {
      minus.push_back(s[i]);
    }
  }
  sort(plus.begin(), plus.end(),
       [](const seg &a, const seg &b) { return a.b > b.b; });
  sort(minus.begin(), minus.end(),
       [](const seg &a, const seg &b) { return a.a > b.a; });
  long long int p = 0;
  while (!plus.empty()) {
    long long int x;
    long long int xx = plus.back().b;
    if (minus.size() == 0 ||
        (plus.size() > 0 && plus.back().b < minus.back().a)) {
      x = plus.back().b;
      plus.pop_back();
    } else {
      x = minus.back().a;
      minus.pop_back();
    }
    if (dif - x >= 0) {
      dif -= x;
      p++;
    } else {
      p = p * xx + dif;
      long long int q = xx * n;
      long long int d = gcd(p, q);
      p /= d;
      q /= d;
      cout << p << " " << q << "\n";
      return 0;
    }
  }
  cout << "0 1\n";
  return 0;
}
