#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
struct Frac {
  long long a, b;
  void normalize() {
    long long g = gcd(a, b);
    a /= g;
    b /= g;
  }
  Frac(long long _a, long long _b) {
    a = _a;
    b = _b;
    normalize();
  }
  bool operator<(const Frac &other) const {
    return (__int128)a * other.b < (__int128)b * other.a;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  assert(n <= 20);
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
  }
  Frac ans(0, 1);
  for (int mask = 0; mask < (1 << n); ++mask) {
    vector<int> cb;
    long long sum_a = 0;
    for (int i = 0; i < n; ++i) {
      if (mask & (1 << i)) {
        sum_a += a[i];
        cb.push_back(b[i]);
      }
    }
    sort(cb.rbegin(), cb.rend());
    long long sum_b = 0;
    Frac cur(0, 1);
    for (int i = 0; i < (int)cb.size(); ++i) {
      if (sum_b + cb[i] <= sum_a) {
        sum_b += cb[i];
      } else {
        long long good = cb[i] - (sum_a - sum_b);
        long long all = cb[i];
        cur = Frac(all * ((int)cb.size() - i - 1) + good, all * n);
        break;
      }
    }
    if (ans < cur) ans = cur;
  }
  cout << ans.a << ' ' << ans.b << '\n';
}
