#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
int main() {
  long long n;
  cin >> n;
  vector<pair<long long, long long> > a;
  long long s = 0;
  for (int i = 0; i < (int)(n); ++i) {
    long long c, d;
    cin >> c >> d;
    if (c < d) {
      s += d - c;
      a.push_back(make_pair(d, (1LL << 60)));
    } else {
      a.push_back(make_pair(c, d));
    }
  }
  long long sm = s;
  if (s == 0) {
    cout << 0 << " " << 1 << endl;
    return 0;
  }
  sort(a.begin(), a.end());
  long long k = 0;
  long long pid = -1;
  long long id = -1;
  long long sk = 0;
  long long sk1 = 0;
  for (int i = 0; i < (int)(n); ++i) {
    if (s >= a[i].first) {
      k++;
      s -= a[i].first;
    } else {
      sk = s;
      sk1 = sk - a[i].first;
      break;
    }
  }
  long long x = k;
  long long y = n;
  long long z = gcd(k, n);
  x /= z;
  y /= z;
  long long xx, yy, zz;
  for (int i = 0; i < (int)(n); ++i) {
    if (a[i].second == (1LL << 60)) {
      if (i < k) {
        if (sk1 + a[i].first > 0) {
          xx = a[i].first * k + sk1 + a[i].first;
          yy = a[i].first * n;
        } else {
          continue;
        }
      } else {
        if (sk > 0) {
          xx = a[i].first * k + sk;
          yy = a[i].first * n;
        } else {
          continue;
        }
      }
      zz = gcd(xx, yy);
      xx /= zz;
      yy /= zz;
      if ((__uint128_t)(x) * (__uint128_t)(yy) <
          (__uint128_t)(y) * (__uint128_t)(xx)) {
        x = xx;
        y = yy;
      }
    } else {
      if (i < k) {
        if (sk1 + a[i].first > 0) {
          xx = a[i].second * k + sk1 + a[i].first;
          yy = a[i].second * n;
        } else {
          continue;
        }
      } else {
        if (sk - a[i].first > 0) {
          xx = a[i].second * k + sk - a[i].first;
          yy = a[i].second * n;
        } else {
          continue;
        }
      }
      zz = gcd(xx, yy);
      xx /= zz;
      yy /= zz;
      if ((__uint128_t)(x) * (__uint128_t)(yy) <
          (__uint128_t)(y) * (__uint128_t)(xx)) {
        x = xx;
        y = yy;
      }
    }
  }
  cout << x << " " << y << endl;
  return 0;
}
