#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using dd = double;
using vdd = std::vector<dd>;
using vvdd = std::vector<vdd>;
using vvvdd = std::vector<vvdd>;
constexpr ll INF = 1LL << 60;
constexpr dd EPS = 1e-11;
struct Fast {
  Fast() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(std::numeric_limits<double>::max_digits10);
  }
} fast;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline T MaxE(vector<T> &v, ll S, ll E) {
  T m = v[S];
  for (ll i = (S); i <= (E); i++) chmax(m, v[i]);
  return m;
}
template <class T>
inline T MinE(vector<T> &v, ll S, ll E) {
  T m = v[S];
  for (ll i = (S); i <= (E); i++) chmin(m, v[i]);
  return m;
}
template <class T>
inline T MaxE(vector<T> &v, ll N) {
  return MaxE(v, 0, N - 1);
}
template <class T>
inline T MinE(vector<T> &v, ll N) {
  return MinE(v, 0, N - 1);
}
template <class T>
inline T MaxE(vector<T> &v) {
  return MaxE(v, (ll)v.size());
}
template <class T>
inline T MinE(vector<T> &v) {
  return MinE(v, (ll)v.size());
}
template <class T>
inline ll MaxI(vector<T> &v, ll S, ll E) {
  ll m = S;
  for (ll i = (S); i <= (E); i++) {
    if (v[i] > v[m]) m = i;
  }
  return m;
}
template <class T>
inline ll MinI(vector<T> &v, ll S, ll E) {
  ll m = S;
  for (ll i = (S); i <= (E); i++) {
    if (v[i] < v[m]) m = i;
  }
  return m;
}
template <class T>
inline ll MaxI(vector<T> &v, ll N) {
  return MaxI(v, 0, N - 1);
}
template <class T>
inline ll MinI(vector<T> &v, ll N) {
  return MinI(v, 0, N - 1);
}
template <class T>
inline ll MaxI(vector<T> &v) {
  return MaxI(v, (ll)v.size());
}
template <class T>
inline ll MinI(vector<T> &v) {
  return MinI(v, (ll)v.size());
}
template <class T>
inline T Sum(vector<T> &v, ll S, ll E) {
  T s = v[S];
  for (ll i = (S + 1); i <= (E); i++) s += v[i];
  return s;
}
template <class T>
inline T Sum(vector<T> &v, ll N) {
  return Sum(v, 0, N - 1);
}
template <class T>
inline T Sum(vector<T> &v) {
  return Sum(v, v.size());
}
template <class T>
inline T POW(T a, ll n) {
  T r = 1;
  for (; n > 0; n >>= 1, a *= a) {
    if (n & 1) r *= a;
  }
  return r;
}
inline ll POW(int a, ll n) { return POW((ll)a, n); }
inline ll MSB(ll a) {
  for (ll o = 63, x = -1;;) {
    ll m = (o + x) / 2;
    if (a < (1LL << m))
      o = m;
    else
      x = m;
    if (o - x == 1) return x;
  }
}
inline ll CEIL(ll a, ll b) { return (a + b - 1) / b; }
template <class T = ll>
inline vector<T> cinv(ll N) {
  vector<T> v(N);
  for (ll i = (0); i <= (N - 1); i++) cin >> v[i];
  return move(v);
}
template <class T = ll, class S = ll>
inline vector<pair<T, S>> cinv2(ll N) {
  vector<pair<T, S>> v(N);
  for (ll i = (0); i <= (N - 1); i++) {
    cin >> v[i].first >> v[i].second;
  }
  return move(v);
}
template <class T = ll, class S = ll, class R = ll>
inline vector<tuple<T, S, R>> cinv3(ll N) {
  vector<tuple<T, S, R>> v(N);
  for (ll i = (0); i <= (N - 1); i++) {
    cin >> get<0>(v[i]) >> get<1>(v[i]) >> get<2>(v[i]);
  }
  return move(v);
}
template <class T = ll, class S = ll, class R = ll, class Q = ll>
inline vector<tuple<T, S, R, Q>> cinv4(ll N) {
  vector<tuple<T, S, R, Q>> v(N);
  for (ll i = (0); i <= (N - 1); i++) {
    cin >> get<0>(v[i]) >> get<1>(v[i]) >> get<2>(v[i]) >> get<3>(v[i]);
  }
  return move(v);
}
template <class T>
inline void coutv(vector<T> &v, char deli = ' ') {
  ll N = (ll)v.size();
  for (ll i = (0); i <= (N - 1); i++) {
    cout << v[i] << ((i == N - 1) ? '\n' : deli);
  }
}
template <class T>
void bye(T a) {
  cout << a << '\n';
  exit(0);
}
struct mll {
  static ll MOD;
  ll val;
  mll(ll v = 0) : val(v % MOD) {
    if (val < 0) val += MOD;
  }
  mll operator-() const { return -val; }
  mll operator+(const mll &b) const { return val + b.val; }
  mll operator-(const mll &b) const { return val - b.val; }
  mll operator*(const mll &b) const { return val * b.val; }
  mll operator/(const mll &b) const { return mll(*this) /= b; }
  mll operator+(ll b) const { return *this + mll(b); }
  mll operator-(ll b) const { return *this - mll(b); }
  mll operator*(ll b) const { return *this * mll(b); }
  friend mll operator+(ll a, const mll &b) { return b + a; }
  friend mll operator-(ll a, const mll &b) { return -b + a; }
  friend mll operator*(ll a, const mll &b) { return b * a; }
  mll &operator+=(const mll &b) {
    val = (val + b.val) % MOD;
    return *this;
  }
  mll &operator-=(const mll &b) {
    val = (val + MOD - b.val) % MOD;
    return *this;
  }
  mll &operator*=(const mll &b) {
    val = (val * b.val) % MOD;
    return *this;
  }
  mll &operator/=(const mll &b) {
    ll c = b.val, d = MOD, u = 1, v = 0;
    while (d) {
      ll t = c / d;
      c -= t * d;
      swap(c, d);
      u -= t * v;
      swap(u, v);
    }
    val = val * u % MOD;
    if (val < 0) val += MOD;
    return *this;
  }
  mll &operator+=(ll b) { return *this += mll(b); }
  mll &operator-=(ll b) { return *this -= mll(b); }
  mll &operator*=(ll b) { return *this *= mll(b); }
  mll &operator/=(ll b) { return *this /= mll(b); }
  bool operator==(const mll &b) { return val == b.val; }
  bool operator!=(const mll &b) { return val != b.val; }
  bool operator==(ll b) { return *this == mll(b); }
  bool operator!=(ll b) { return *this != mll(b); }
  friend bool operator==(ll a, const mll &b) { return mll(a) == b.val; }
  friend bool operator!=(ll a, const mll &b) { return mll(a) != b.val; }
  friend ostream &operator<<(ostream &os, const mll &a) { return os << a.val; }
  friend istream &operator>>(istream &is, mll &a) { return is >> a.val; }
  static mll Combination(ll a, ll b) {
    chmin(b, a - b);
    if (b < 0) return mll(0);
    mll c = 1;
    for (ll i = (0); i <= (b - 1); i++) c *= a - i;
    for (ll i = (0); i <= (b - 1); i++) c /= i + 1;
    return c;
  }
};
ll mll::MOD = (ll)(1e9 + 7);
using vmll = std::vector<mll>;
using vvmll = std::vector<vmll>;
using vvvmll = std::vector<vvmll>;
using vvvvmll = std::vector<vvvmll>;
ll Gcd(ll num1, ll num2) {
  ll numA, numB;
  if (num1 > num2) {
    numA = num2;
    numB = num1;
  } else {
    numA = num1;
    numB = num2;
  }
  if (numA == 0) return numB;
  while (1) {
    ll numC = numB % numA;
    if (numC == 0) return numA;
    numB = numA;
    numA = numC;
  }
}
void output(ll p, ll q) {
  ll P, Q;
  if (p == 0) {
    P = 0;
    Q = 1;
  } else {
    ll gcd = Gcd(p, q);
    P = p / gcd;
    Q = q / gcd;
  }
  cout << P << " " << Q << '\n';
}
void solve() {
  ll N;
  cin >> N;
  auto AB = cinv2(N);
  vll C(N), v(N);
  for (ll i = (0); i <= (N - 1); i++) {
    ll A = AB[i].first;
    ll B = AB[i].second;
    C[i] = (B - A > 0) ? (B - A) : 0;
    v[i] = std::max(A, B);
  }
  ll allC = Sum(C);
  if (allC == 0) {
    output(0, 1);
    return;
  }
  vector<tuple<ll, ll, ll>> vAB;
  for (ll i = (0); i <= (N - 1); i++)
    vAB.emplace_back(v[i], AB[i].first, AB[i].second);
  std::sort(vAB.begin(), vAB.end());
  ll n = 0;
  ll sumv = 0;
  for (ll i = (0); i <= (N - 1); i++) {
    ll v = std::get<0>(vAB[i]);
    ll A = std::get<1>(vAB[i]);
    ll B = std::get<2>(vAB[i]);
    if (sumv + v > allC) {
      n = i;
      break;
    }
    sumv += v;
  }
  if (sumv == allC) {
    output(n, N);
    return;
  }
  ll diffV = allC - sumv;
  double maxW = 0.0;
  ll maxI = -1;
  for (ll i = (n); i <= (N - 1); i++) {
    ll v = std::get<0>(vAB[i]);
    ll A = std::get<1>(vAB[i]);
    ll B = std::get<2>(vAB[i]);
    double w;
    if (A <= B)
      w = diffV / (double)B;
    else
      w = (diffV - A + B) / (double)B;
    if (maxW < w) {
      maxW = w;
      maxI = i;
    }
  }
  {
    ll i = maxI;
    ll v = std::get<0>(vAB[i]);
    ll A = std::get<1>(vAB[i]);
    ll B = std::get<2>(vAB[i]);
    ll p, q;
    if (A <= B) {
      p = diffV;
      q = B;
    } else {
      p = diffV - A + B;
      q = B;
    }
    output(n * q + p, N * q);
  }
}
int main() {
  solve();
  return 0;
}
