use std::io; const MOD: u64 = 1_000_000_007; struct F { // i桁のjで始まるAscNumberはいくつあるか // 1 <= i <= 1000000 // 1 <= j <= 9 memo: Vec>>, } impl F { fn new() -> Self { let mut memo = vec![vec![None; 10]; 1000001]; for j in 1..10 { memo[1][j] = Some(1); } Self { memo, } } fn call(&mut self, i: usize, j: usize) -> u64 { debug_assert!(1 <= i && i <= 1000000); debug_assert!(1 <= j && j <= 9); if let Some(res) = self.memo[i][j] { return res; } let mut res = 0; for j2 in j..10 { res += self.call(i-1, j2); res %= MOD; } self.memo[i][j] = Some(res); res } } fn main() { let mut s = String::new(); io::stdin().read_line(&mut s).unwrap(); let n: usize = s.trim().parse().unwrap(); let mut f = F::new(); let mut ans = 1; // 0 もAscNumber for i in 1..n+1 { for j in 1..10 { ans += f.call(i,j); ans %= MOD; }} println!("{}", ans); }