#include <bits/stdc++.h>
using namespace std;
struct Piece {
  int a;
  int b;
  int index;
};
bool cmp(Piece &a, Piece &b) {
  if (a.b != b.b) return (a.b < b.b);
  return (a.a < b.a);
}
bool cmp2(Piece &a, Piece &b) { return (a.a < b.a); }
struct Vertex {
  long long sum;
  int cnt;
};
vector<Vertex> rmq;
bool more(long long a, long long b, long long c, long long d) {
  __int128_t A = a, B = b, C = c, D = d;
  return (A * D >= B * C);
}
__int128_t gcd(__int128_t first, __int128_t second) {
  if (second == 0) return first;
  return gcd(second, first % second);
}
string blyad(__int128_t first) {
  string res = "";
  if (first == 0) return "0";
  while (first > 0) {
    res += (char)('0' + first % 10);
    first /= 10;
  }
  reverse(res.begin(), res.end());
  return res;
}
pair<long long, int> suka(int i, int l, int r, long long delta) {
  if (r - l == 1) {
    if (rmq[i].cnt == 0) return {0, 0};
    if (rmq[i].sum > delta) return {0, 0};
    return {rmq[i].sum, 1};
  }
  int mid = (l + r) / 2;
  if (rmq[2 * i + 1].sum > delta) {
    return suka(2 * i + 1, l, mid, delta);
  }
  long long S = rmq[2 * i + 1].sum;
  int c = rmq[2 * i + 1].cnt;
  pair<long long, int> res = suka(2 * i + 2, mid, r, delta - S);
  return {res.first + S, res.second + c};
}
void change(int i, int l, int r, int index, long long val) {
  if (r - l == 1) {
    rmq[i] = {val, 1};
    return;
  }
  int mid = (l + r) / 2;
  if (index < mid)
    change(2 * i + 1, l, mid, index, val);
  else
    change(2 * i + 2, mid, r, index, val);
  rmq[i].sum = rmq[2 * i + 1].sum + rmq[2 * i + 2].sum;
  rmq[i].cnt = rmq[2 * i + 1].cnt + rmq[2 * i + 2].cnt;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<Piece> v;
  for (int i = 0; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    v.push_back({a, b, i});
  }
  sort(v.begin(), v.end(), cmp2);
  rmq.assign(4 * n, {0, 0});
  vector<int> posa(n);
  for (int i = 0; i < n; ++i) {
    posa[v[i].index] = i;
  }
  sort(v.begin(), v.end(), cmp);
  long long delta = 0;
  long long A = 0, e = 0, q = 1;
  for (int i = 0; i < n; ++i) {
    if (v[i].b >= v[i].a) delta += (v[i].b - v[i].a);
  }
  multiset<pair<long long, long long> > tet;
  for (int i = 0; i < n; ++i) {
    if (v[i].b >= v[i].a) tet.insert({-v[i].b, -v[i].a});
  }
  long long zero = 0;
  for (int i = 0; i < n; ++i) {
    if (delta > 0) {
      pair<long long, int> p = suka(0, 0, n, delta);
      auto it = tet.end();
      it--;
      pair<long long, long long> best = (*it);
      long long bb = -best.first, aa = -best.second;
      long long C = (delta - p.first), zn = bb;
      if (C >= zn) {
        C = 0, zn = 1, p.second++;
      }
      if (p.second > A) {
        A = p.second, e = C, q = zn;
      } else if (p.second == A) {
        if (more(C, zn, e, q)) {
          e = C, q = zn;
        }
      }
    }
    int I = v[i].index;
    change(0, 0, n, posa[I], v[i].a);
    if (v[i].b >= v[i].a) tet.erase(tet.find({-v[i].b, -v[i].a}));
    if (v[i].b >= v[i].a) {
      delta -= (v[i].b - v[i].a);
    }
  }
  __int128_t a = A, E = e, Q = q;
  E += Q * a;
  Q *= n;
  __int128_t g = gcd(E, Q);
  E /= g, Q /= g;
  string T = blyad(E), B = blyad(Q);
  cout << T << " " << B;
}
