use std::io::Read; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let n: Vec = s.split_whitespace().skip(1).flat_map(str::parse).collect(); let a: u128 = n.chunks(2).map(|a| (a[0] + 1) / 2 * a[1]).sum(); println!("{}", a % 1000000007) }