#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int sum(int a, int b) {
  int c = a + b;
  if (c >= mod) {
    c -= mod;
  }
  return c;
}
int dif(int a, int b) {
  int c = a - b;
  if (c < 0) {
    c += mod;
  }
  return c;
}
int mlt(int a, int b) {
  long long c = a * 1LL * b;
  return c % mod;
}
int ibit(int n, int i) { return ((n >> i) & 1); }
void outp(vector<vector<int>> &ou) {
  for (int i = 0; i < ou.size(); i++) {
    for (int j = 0; j < ou[i].size(); j++) {
      cout << ou[i][j] << ' ';
    }
    cout << '\n';
  }
}
int bp(int x, int y) {
  if (y == 0) {
    return 1;
  }
  int a = 0;
  if (!(y % 2)) {
    a = bp(x, y / 2);
  }
  return (y % 2) ? mlt(bp(x, y - 1), x) : mlt(a, a);
}
int obr(int x) { return bp(x, mod - 2); }
const int maxn = 10000007;
int fact[1000007], ofact[1000007];
void prec() {
  fact[0] = 1;
  ofact[0] = 1;
  for (int i = 1; i < maxn; i++) {
    fact[i] = mlt(fact[i - 1], i);
  }
  ofact[maxn - 1] = obr(fact[maxn - 1]);
  for (int i = maxn - 2; i > 0; i--) {
    ofact[i] = mlt(ofact[i + 1], i + 1);
  }
}
int c(int a, int b) {
  return ((a <= b) && (a >= 0)) ? mlt(fact[b], mlt(ofact[a], ofact[b - a])) : 0;
}
long long gcd(long long x, long long y) {
  if (x == 0) return y;
  return (x > y) ? gcd(y, x) : gcd(y % x, x);
}
void upd(long long x, long long y, long long &curx, long long &cury) {
  long double x1 = (long double)x / (long double)y;
  long double cur1 = (long double)curx / long double(cury);
  if (x1 > cur1 + 1e-17) {
    curx = x / gcd(x, y);
    cury = y / gcd(x, y);
  }
}
long long good(vector<long long> &prefs, vector<int> &a, vector<int> &b,
               int excl, int len, int sum, vector<int> &ord,
               vector<pair<int, int>> &h) {
  if (len < 0) return 0LL;
  if (len >= ord.size()) return -1LL;
  long long sum1 = sum - max(0, b[excl] - a[excl]), psum = prefs[len];
  if (ord[excl] < len) psum = psum - max(a[excl], b[excl]) + h[len].first;
  sum1 += b[excl] - a[excl];
  return max(sum1 - psum, -1LL);
}
void solve(istream &cin = std::cin, ostream &cout = std::cout) {
  int n;
  cin >> n;
  vector<pair<int, int>> h(n);
  vector<int> a(n), b(n), ord(n);
  vector<long long> prefs(n + 1);
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    h[i] = make_pair(max(a[i], b[i]), i);
    sum += max(b[i] - a[i], 0);
  }
  sort(h.begin(), h.end());
  for (int i = 0; i < n; i++) {
    prefs[i + 1] = prefs[i] + h[i].first;
    ord[h[i].second] = i;
  }
  long long curx = 0, cury = 1;
  for (int k = 0; k < n; k++) {
    int lb = -1, rb = n - 1;
    for (int i = 0; i < 50; i++) {
      int mid = (rb + lb + i % 2) / 2;
      long long val = good(prefs, a, b, k, mid, sum, ord, h);
      if (val < 0)
        rb = mid - 1;
      else {
        lb = mid;
        long long num = mid * 1LL * b[mid] + min(val, (long long)b[mid]),
                  den = b[mid] * 1LL * n;
        upd(num, den, curx, cury);
      }
    }
  }
  cout << curx << ' ' << cury << endl;
}
int main() {
  solve();
  int n;
  cin >> n;
}
