#include <bits/stdc++.h>

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

int n;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  range(i, 0, n) {
    cin >> a[i] >> b[i];
  }
  auto solve = [&](vector<int> id) {
    sort(id.begin(), id.end(), [&](int x, int y){return b[x] < b[y];});
    long long cur = 0;
    long long sum = 0;
    int pos = 0;
    for(int i : id) cur += b[i] - a[i];
    while(sum + b[id[pos]] <= cur) {
      sum += b[id[pos]];
      pos++;
    }
    long long u = 1LL * pos * b[id[pos]] + cur - sum;
    long long v = b[id[pos]];
    return make_pair(u, v);
  };
  long long cur = 0;
  vector<int> pr;
  vector<int> id;
  range(i, 0, n) {
    if(b[i] >= a[i]) {
      cur += b[i] - a[i];
      pr.push_back(i);
    } else id.push_back(i);
  }
  if(cur == 0) {
    cout << "0 1\n";
    return 0;
  }
  auto foo = solve(id);
  long long u = foo.first;
  long long v = foo.second;
  sort(id.begin(), id.end(), [&](int x, int y){return b[x] < b[y];});
  range(i, 0, (int) id.size()) {
    sort(id.begin(), id.begin() + i, [&](int x, int y){return a[x] < a[y];});
    vector<int> c = pr;
    c.push_back(id[i]);
    long long su, sv;
    foo = solve(c);
    su = foo.first; sv = foo.second;
    if(su * v > sv * u) {
      u = su; v = sv;
    }
    range(j, 0, i) {
      c.push_back(id[j]);
      foo = solve(c);
      su = foo.first; sv = foo.second;
      if(su * v > sv * u) {
        u = su; v = sv;
      }
    }
  }
  v *= n;
  long long g = __gcd(u, v);
  cout << u / g << " " << v / g;
  return 0;
}
