function solve() n = parse(Int, readline()) a = readline() |> split |> x -> parse.(Int, x) a = sort(a) result = 0 m = 998244353 for ai = a result = 10 * result + ai result = result % m end println(result) end solve()