Kanade's convolution
TimeLimit:5000MS MemoryLimit:524288KB
64-bit integer IO format:%I64d
Problem Description
Give you two arrays $A[0..2^m-1]$ and $B[0..2^m-1]$.
Please calculate array $C[0..2^m-1]$:
$$C[k]=\sum_{i~and~j=k}A[i~xor~j]*B[i~or~j]$$
You just need to print $\sum_{i=0}^{2^m-1}C[i]*1526^i ~mod~998244353$
$m<=19$
$0\leq A[i],B[i]< 998244353$
Input
There is only one test case.
The first line consists of one integer $m$.
The second line consists of $2^m$ integers $A[0..2^m-1]$
The third line consists of $2^m$ integers $B[0..2^m-1]$
Output
Output only one integer means the answer.