use std::{ops::*, fmt::*, mem::*}; const MOD: isize = 998244353; //const MOD: isize = 1000000007; #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] struct Modint { x: isize } impl Modint { fn new(x: isize) -> Self { if x < 0 { Self {x: x + MOD} } else { Self {x: x % MOD} } } fn inv(self) -> Self { let mut a = self.x; let mut b = MOD; let mut u: isize = 1; let mut v: isize = 0; while b != 0 { let t = a / b; a -= t * b; u -= t * v; swap(&mut a, &mut b); swap(&mut u, &mut v); } Self { x: (u % MOD + MOD) % MOD } } fn pow(self, n: isize) -> Self { if n == 1 { Self { x: self.x % MOD } } else if n % 2 == 1 { Self {x: (self.x * self.pow(n - 1).x) % MOD } } else { Self { x: self.pow(n / 2).x.pow(2) % MOD } } } } impl Add for Modint { type Output = Modint; fn add(self, rhs: Modint) -> Self { Self::new(self.x + rhs.x) } } impl AddAssign for Modint { fn add_assign(&mut self, rhs: Self) { self.x = (*self + rhs).x; } }impl Sub for Modint { type Output = Modint; fn sub(self, rhs: Modint) -> Self { Self::new(self.x - rhs.x + MOD) } } impl SubAssign for Modint { fn sub_assign(&mut self, rhs: Self) { self.x = (*self - rhs).x; } } impl Mul for Modint { type Output = Modint; fn mul(self, rhs: Modint) -> Self { Self::new(self.x * rhs.x) } } impl MulAssign for Modint { fn mul_assign(&mut self, rhs: Self) { self.x = (*self * rhs).x; } } impl Div for Modint { type Output = Modint; fn div(self, rhs: Self) -> Self { self * rhs.inv() } } impl DivAssign for Modint { fn div_assign(&mut self, rhs: Self) { self.x = (*self / rhs).x; } } impl Display for Modint { fn fmt(&self, f: &mut Formatter<'_>) -> Result { write!(f, "{}", self.x) } } fn fac(n: isize) -> isize { if n <= 1 { return 1 } else { return (n * fac(n - 1)) % MOD } } fn main() { let (n, a, b): (usize, usize, usize) = { // 定数個の整数を受け取り, 定数個の変数に束縛する let mut line: String = String::new(); std::io::stdin().read_line(&mut line).unwrap(); let mut iter = line.split_whitespace(); ( iter.next().unwrap().parse().unwrap(), iter.next().unwrap().parse().unwrap(), iter.next().unwrap().parse().unwrap() ) }; if n == 2 { if a == b { println!("{}", 0); return } else { println!("{}", 1); return } } let mut ans = Modint::new(0); if a == b { ans = Modint::new(n as isize - 1) * Modint::new(n as isize - 2) * Modint::new(fac(n as isize - 3)); } else { ans = Modint::new(n as isize - 2) * Modint::new(n as isize - 3) * Modint::new(fac(n as isize - 2)) + Modint::new(2) * Modint::new(n as isize - 2) * Modint::new(fac(n as isize - 2)) + Modint::new(fac(n as isize - 2)); } println!("{}", ans); }