use std::cmp;
use std::io::Read;

fn gcd(a: i64, b: i64) -> i64 {
    if a == 0 {
        1
    } else if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n = iter.next().unwrap().parse().unwrap();

    let mut beams = (0..n)
        .map(|_| {
            let a: i64 = iter.next().unwrap().parse().unwrap();
            let b: i64 = iter.next().unwrap().parse().unwrap();
            (a, b)
        })
        .collect::<Vec<(i64, i64)>>();
    let target_sum: i64 = beams.iter().map(|&(a, _)| a).sum();

    beams.sort_by(|&(a1, b1), &(a2, b2)| {
        let max1 = cmp::max(a1, b1);
        let max2 = cmp::max(a2, b2);
        max2.cmp(&max1)
    });

    let mut k = 0;
    let mut sum = 0;
    while sum < target_sum {
        sum += cmp::max(beams[k].0, beams[k].1);
        k += 1;
    }

    let mut num: i64 = 0;
    let mut den: i64 = 1;
    for i in 0..n {
        let ind = cmp::min(k - 1, i);
        let rest = target_sum - (sum - cmp::max(beams[ind].0, beams[ind].1));
        if rest <= beams[i].1 {
            let tmp_num = rest;
            let tmp_den = beams[i].1;
            if tmp_num * den > tmp_den * num {
                num = tmp_num;
                den = tmp_den;
            }
        }
    }
    num = (n - k) as i64 * den + num;
    den *= n as i64;
    let d = gcd(num, den);
    println!("{} {}", num / d, den / d);
}
