问题 F: Calculate sum

内存限制:512 MB 时间限制:6 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:1 通过:1

题目描述

You are given an array of integers a1, a2, …, ana_1, \ a_2, \ \dots , \ a_na1, a2, , an.

Define bi,j(1≤i<j≤n)=a1, a2, … , ai−1, aj, aj−1, … , ai+1, ai, aj+1,b_{i,j}(1 \le i <j \le n )= a_1, \ a_2, \ \dots \ , \ a_{i-1}, \ a_j, \ a_{j-1}, \ \dots \ , \ a_{i+1}, \ a_i, \ a_{j+1},bi,j(1i<jn)=a1, a2,  , ai1, aj, aj1,  , ai+1, ai, aj+1, … , an\dots \ , \ a_n , an. Which means you choose two indexes iii and jjj, then reverse ai, ai+1, … aj−1, aja_i,\ a_{i+1}, \ \dots \, \ a_{j-1}, \ a_jai, ai+1,  aj1, aj.

You should calculate for k=2k=2k=2 to 2×n2\times n2×n, (∑i=1n∑j=i+1n∑1≤x,y≤n, x+y=k(bi,j)x×(bi,j)y)(\sum_{i=1}^{n} \sum_{j=i+1}^{n} \sum_{1 \le x,y \le n, \ x+y=k} (b_{i,j})_x \times (b_{i,j})_{y})(i=1nj=i+1n1x,yn, x+y=k(bi,j)x×(bi,j)y) modulo 998244353998244353998244353.

输入格式

The first line contains a positive integer nnn(2≤n≤1052 \le n \le 10^52n105).
The second line contains nnn integers a1,a2,…,ana_1,a_2,\dots ,a_na1,a2,,an(0≤ai≤1080 \le a_i \le 10^80ai108).

输出格式

Output 2×n−12 \times n-12×n1 lines, each of which contains a single integer , denoting the answer taken modulo 998244353998244353998244353---the iii-th number is for the answer of k=i+1(1≤i≤2×n−1)k=i+1(1\le i \le 2 \times n-1)k=i+1(1i2×n1).

输入样例 复制

5
2 4 8 7 5

输出样例 复制

178
390
707
1022
1341
1232
995
612
283