use std::io::Read; macro_rules! tok { ($iter: expr) => { $iter.next().unwrap().parse().unwrap() } } use std::collections::HashMap; const M: usize = 998244353; fn prime_division(mut a: usize, spfs: &Vec) -> Vec<(usize, usize)> { let mut primes: Vec = Vec::new(); while a != 1 { primes.push(spfs[a]); a /= spfs[a]; } primes.sort(); primes.push(0); // println!("{:?}", primes); let mut groups: Vec<(usize, usize)> = Vec::new(); let mut count = 1; for i in 1..primes.len() { if primes[i] != primes[i-1] { groups.push((primes[i-1], count)); count = 0; } count += 1; } groups } fn main() { let mut buf = String::new(); std::io::stdin().read_to_string(&mut buf).unwrap(); let mut iter = buf.split_whitespace(); let n: usize = tok!(iter); let mut spfs: Vec = (0..=n).collect(); { let mut a = 2; while a * a <= n { if spfs[a] == a { for b in (a*a..=n).step_by(a) { if spfs[b] == b { spfs[b] = a } } } a += 1; } } let mut last_prime: usize = 0; for a in (2..=n).rev() { if spfs[a] == a { last_prime = a; break; } } // let mut counts: Vec = vec![0; 1000 + 1]; let mut counts: HashMap = HashMap::new(); for a in 2..=n { if a == last_prime { continue; } // if a % 10000 == 0 { println!("{}", a); } let ps = prime_division(a, &spfs); // println!("a = {}, ps = {:?}", a, ps); for (p, cnt) in ps { if !counts.contains_key(&p) || counts[&p] < cnt { counts.insert(p, cnt); } } } let mut ans: usize = 1; for (p, cnt) in counts { for _ in 1..=cnt { ans = (ans * p) % M; } } println!("{}", ans); }