const MOD: usize = 998244353; fn power(base: usize, times: usize) -> usize { if times == 0 { return 1usize; } if times == 1 { return base; } let temp = power(base, times/2); temp * temp % MOD * power(base, times%2) % MOD } fn main() { let mut nm = String::new(); std::io::stdin().read_line(&mut nm).ok(); let nm: Vec = nm.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nm[0]; let m = nm[1]; let mut powers = vec![0usize; m+1]; for i in 1..=m { powers[i] = power(i, n); } let mut result = 0usize; for i in 1..=m { result += (MOD + powers[i] - powers[i-1]) * i % MOD; result += MOD - (MOD + powers[m-i+1] - powers[m-i]) * i % MOD; result %= MOD; } let exp = (m+1) % MOD * power(2, MOD-2) % MOD * (n % MOD) % MOD; println!("{}", exp * result % MOD); }