#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  int f = 1;
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= f;
}
template <class T>
inline void umin(T &x, T y) {
  x = x < y ? x : y;
}
template <class T>
inline void umax(T &x, T y) {
  x = x > y ? x : y;
}
inline unsigned int R() {
  static unsigned int seed = 416;
  return seed ^= seed >> 5, seed ^= seed << 17, seed ^= seed >> 13;
}
const int N = 266666;
int n, v[N];
pair<int, int> s[N];
struct Frac {
  long long first, second;
  Frac(long long A = 0, long long B = 1) {
    first = A;
    second = B;
  }
} ans;
long long gcd(long long first, long long second) {
  return !second ? first : gcd(second, first % second);
}
inline Frac Norm(Frac y) {
  long long g = gcd(y.first, y.second);
  y.first /= g;
  y.second /= g;
  return y;
}
inline void upd(Frac &x, Frac y) {
  y = Norm(y);
  if (1.0 * x.first / x.second > 1.0 * y.first / y.second) x = y;
}
bool cmp(pair<int, int> x, pair<int, int> y) {
  return x.first + max(x.second - x.first, 0) <
         y.first + max(y.second - y.first, 0);
}
bool ck(int k) {
  long long tot = 0;
  for (register int i = (1); i <= (n); i++)
    tot += max(s[i].second - s[i].first, 0);
  for (register int i = (1); i <= (k); i++) tot -= v[i];
  return tot >= 0;
}
int main() {
  read(n);
  for (register int i = (1); i <= (n); i++) read(s[i].first), read(s[i].second);
  sort(s + 1, s + n + 1, cmp);
  for (register int i = (1); i <= (n); i++)
    v[i] = s[i].first + max(s[i].second - s[i].first, 0);
  int L = 0, R = n;
  while (L < R) {
    int mid = (L + R) >> 1;
    if (ck(mid))
      L = mid;
    else
      R = mid - 1;
  }
  int k = L;
  assert(k < n);
  long long ori = 0;
  for (register int i = (1); i <= (n); i++)
    ori += max(s[i].second - s[i].first, 0);
  for (register int i = (1); i <= (k); i++) ori -= v[i];
  ans.first = 1;
  ans.second = 1;
  for (register int i = (1); i <= (n); i++) {
    long long tot = ori;
    if (i <= k)
      tot = tot + s[i].first - v[k + 1];
    else
      tot -= max(s[i].second - s[i].first, 0);
    upd(ans, (Frac){s[i].first - tot, s[i].second});
  }
  long long x = ans.first, y = ans.second;
  ans = (Frac){y - x + y * k, n * y};
  ans = Norm(ans);
  printf("%lld %lld\n", ans.first, ans.second);
  return 0;
}
