use std::io::Read;

fn main() {
	let mut s = String::new();
	std::io::stdin().read_to_string(&mut s).ok();
	let mut v: Vec<u64> =
		s.split_whitespace().skip(1).flat_map(str::parse).collect();
	v.sort();
	println!("{}", v.iter().fold(0, |a, &x| (10 * a + x) % 998244353))
}