#ABC220D. [ABC220D] FG operation

[ABC220D] FG operation

Score : 400400 points

Problem Statement

We have a sequence of NN integers between 00 and 99 (inclusive): A=(A1,,AN)A=(A_1, \dots, A_N), arranged from left to right in this order.

Until the length of the sequence becomes 11, we will repeatedly do the operation FF or GG below.

  • Operation FF: delete the leftmost two values (let us call them xx and yy) and then insert (x+y)%10(x+y)\%10 to the left end.
  • Operation GG: delete the leftmost two values (let us call them xx and yy) and then insert (x×y)%10(x\times y)\%10 to the left end.

Here, a%ba\%b denotes the remainder when aa is divided by bb.

For each K=0,1,,9K=0,1,\dots,9, answer the following question.

Among the 2N12^{N-1} possible ways in which we do the operations, how many end up with KK being the final value of the sequence? Since the answer can be enormous, find it modulo 998244353998244353.

Constraints

  • 2N1052 \leq N \leq 10^5
  • 0Ai90 \leq A_i \leq 9
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

A1A_1 \dots ANA_N

Output

Print ten lines. The ii-th line should contain the answer for the case K=i1K=i-1.

3
2 7 6
1
0
0
0
2
1
0
0
0
0

If we do Operation FF first and Operation FF second: the sequence becomes (2,7,6)(9,6)(5)(2,7,6) \to (9,6) \to (5). If we do Operation FF first and Operation GG second: the sequence becomes (2,7,6)(9,6)(4)(2,7,6) \to (9,6) \to (4). If we do Operation GG first and Operation FF second: the sequence becomes (2,7,6)(4,6)(0)(2,7,6) \to (4,6) \to (0). If we do Operation GG first and Operation GG second: the sequence becomes (2,7,6)(4,6)(4)(2,7,6) \to (4,6) \to (4).

5
0 1 2 3 4
6
0
1
1
4
0
1
1
0
2