use std::io::*; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n: usize = itr.next().unwrap().parse().unwrap(); let mut a: Vec = itr.map(|e| e.parse().unwrap()).collect(); const MOD: usize = 1_000_000_007; for i in 0..n { for j in 0..n - i - 1 { a[j] = (a[j] + a[j + 1]) % MOD; } } println!("{}", a[0]); }