fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let n: usize = n.trim().parse().unwrap(); const DIVIDER: usize = 1_000_000_007; let mut result: usize = 0; for _ in 0..n { let mut cd = String::new(); std::io::stdin().read_line(&mut cd).ok(); let cd: Vec = cd.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); result += (cd[0] + 1) / 2 * cd[1]; result %= DIVIDER; } println!("{}", result); }