use std::io::Read; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n: u64 = itr.next().unwrap().parse().unwrap(); let mut a = 0; let mut b = 0; for _ in 0..n { let c: usize = itr.next().unwrap().parse().unwrap(); let d: usize = itr.next().unwrap().len(); let m = 12 * c / 1000; if m >= d { a += d; } else { a += m; b += d - m; } } println!("{} {}", a, b); }