CF856C Eleventh Birthday
Description
It is Borya's eleventh birthday, and he has got a great present: $ n $ cards with numbers. The $ i $ -th card has the number $ a_{i} $ written on it. Borya wants to put his cards in a row to get one greater number. For example, if Borya has cards with numbers $ 1 $ , $ 31 $ , and $ 12 $ , and he puts them in a row in this order, he would get a number $ 13112 $ .
He is only 11, but he already knows that there are $ n! $ ways to put his cards in a row. But today is a special day, so he is only interested in such ways that the resulting big number is divisible by eleven. So, the way from the previous paragraph is good, because $ 13112=1192×11 $ , but if he puts the cards in the following order: $ 31 $ , $ 1 $ , $ 12 $ , he would get a number $ 31112 $ , it is not divisible by $ 11 $ , so this way is not good for Borya. Help Borya to find out how many good ways to put the cards are there.
Borya considers all cards different, even if some of them contain the same number. For example, if Borya has two cards with 1 on it, there are two good ways.
Help Borya, find the number of good ways to put the cards. This number can be large, so output it modulo $ 998244353 $ .
Input Format
N/A
Output Format
N/A