const DIVISOR: u64 = 10u64.pow(9) + 7; fn main() { let mut xx = String::new(); std::io::Read::read_to_string(&mut std::io::stdin(), &mut xx).ok(); let mut xx: Vec = xx.split_whitespace().skip(1).flat_map(str::parse).collect(); while xx.len() >= 2 { xx = xx.windows(2).map(|x| (x[0] + x[1]) % DIVISOR).collect(); } println!("{}", xx[0]); }