import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }


alias Bal = Tuple!(long, "a", long, "b");
alias Rat = Tuple!(long, "p", long, "q");

int N;
Bal[] P;
long[] rs;

Rat calc(int l) {
  Rat ret = Rat(-1, 1);
  long sum;
  BinaryHeap!(Array!long) que;
  foreach (i; 0 .. N) {
    if (i >= l) {
      /*
        sum + (P[i].a - (1 - t) P[i].b) + rs[i + 1] <= 0
      */
      debug {
        writeln(l, " ", i, ": ", sum, " ", P[i], " ", rs[i + 1]);
      }
      long p = -(sum + P[i].a - P[i].b + rs[i + 1]);
      long q = P[i].b;
      if (p >= 0) {
        chmin(p, q);
        if (ret.p * q < p * ret.q) {
          ret = Rat(p, q);
        }
      }
    }
    sum += P[i].a;
    que.insert(P[i].a);
    if (i >= l) {
      sum -= que.front;
      que.removeFront;
    }
  }
  debug {
    writeln("calc ", l, " = ", ret);
  }
  return ret;
}

void main() {
  try {
    for (; ; ) {
      N = readInt();
      P = new Bal[N];
      foreach (i; 0 .. N) {
        P[i].a = readLong();
        P[i].b = readLong();
      }
      P.sort!((x, y) => (x.b < y.b));
      
      rs = new long[N + 1];
      foreach_reverse (i; 0 .. N) {
        rs[i] = rs[i + 1];
        if (P[i].a - P[i].b < 0) {
          rs[i] += P[i].a - P[i].b;
        }
      }
      debug {
        writeln("P = ", P);
        writeln("rs = ", rs);
      }
      
      int lo = 0, hi = N;
      for (; lo + 1 < hi; ) {
        const mid = (lo + hi) / 2;
        const res = calc(mid);
        (res.p >= 0) ? (lo = mid) : (hi = mid);
      }
      
      /*
               res.p  
         lo + ------- 
               res.q  
        --------------
              N       
      */
      const res = calc(lo);
      long p = lo * res.q + max(res.p, 0);
      long q = res.q * N;
      const g = gcd(p, q);
      p /= g;
      q /= g;
      writeln(p, " ", q);
    }
  } catch (EOFException e) {
  }
}
