use std::io::*; const MOD: u64 = 998244353; fn main() { let mut s: String = 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 l: usize = itr.next().unwrap().parse().unwrap(); let r: usize = itr.next().unwrap().parse().unwrap(); let a: Vec = (0..n) .map(|_| itr.next().unwrap().parse().unwrap()) .collect(); let mut dp: Vec> = vec![vec![0; n]; r + 1]; let mut ans = 0; for i in 0..r { let mut s = dp[i].iter().sum::(); if i == 0 { s += 1; } for j in 0..n { let t = s - dp[i][j]; for k in 1..=a[j] { let u = i + (j + 1) * k; if u > r { break; } dp[u][j] = (dp[u][j] + t) % MOD; if u >= l { ans = (ans + t) % MOD; } } } } println!("{}", ans); }