const MOD: usize = 1e9 as usize + 7; fn power(target: &Vec>, times: usize) -> Vec> { let n = target.len(); if times == 0 { let mut ret = vec![vec![0usize; n]; n]; for i in 0..n { ret[i][i] = 1; } return ret; } if times == 1 { return target.clone(); } let temp = power(target, times/2); if times % 2 == 0 { calc(&temp, &temp) } else { calc(&calc(&temp, &temp), target) } } fn calc(left: &Vec>, right: &Vec>) -> Vec> { let sizei = left.len(); let sizej = right[0].len(); let sizek = left[0].len(); let mut ret = vec![vec![0usize; sizej]; sizei]; for i in 0..sizei { for j in 0..sizej { ret[i][j] = (0..sizek).map(|k| left[i][k] * right[k][j] % MOD).sum::() % MOD; } } ret } fn main() { let mut nkl = String::new(); std::io::stdin().read_line(&mut nkl).ok(); let nkl: Vec = nkl.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nkl[0]; let k = nkl[1]; let l = nkl[2]; let mut op = vec![vec![0usize; n]; n]; for i in 0..n { for j in 1..=l { let val = (i+j) % n; op[val][i] = 1; } } let op = power(&op, k); for i in 0..n { println!("{}", op[i][0]); } }