import sys
input = sys.stdin.readline
def gcd(a, b):
    while b: a, b = b, a % b
    return abs(a)

N = int(input())
S = 0
Y = []
for _ in range(N):
    a, b = map(int, input().split())
    if b > a:
        S += b-a
        Y.append((b, b))
    else:
        Y.append((a, b))

Y = sorted(Y)
YY = [0] * (N+1)
for i in range(N):
    YY[i+1] = YY[i] + Y[i][0]

l = 0
r = N
while r - l > 1:
    m = (l+r) // 2
    if S - YY[m] >= 0:
        l = m
    else:
        r = m

a = l * Y[l+1][1] + S - YY[l]
b = N * Y[l+1][1]
g = gcd(a, b)

print(a//g, b//g)