{-# LANGUAGE OverloadedStrings #-} import Data.Text (Text) import qualified Data.Text as T import qualified Data.Text.IO as T import qualified Data.Text.Read as T import Data.List (sort) main :: IO () main = T.getLine >> solve <$> f >>= print where f = map (either (const 0) fst . T.decimal) <$> T.words <$> T.getLine solve :: [Int] -> Int solve = foldl f 0 . sort where m = 998244353 f x y = (x * 10 + y) `mod` m