#429. I love max and multiply
I love max and multiply
Description
Mr.I has two sequence and of length n,.
Define an array C of length n, where , satisfying .
& is the button under binary Bitwise AND operation.
Please calculate the value of , modulo 998244353.
Format
Input
The first line contains an integer T . Then T test cases follow.
Each test case contains three lines.
The first one contains an integer — length of the array a.
The second one contains n integers
The third one contains n integers
∑n≤219
Output
For each test case, output a single integer ans,where modulo 998244353.
Samples
1
4
9 1 4 1
5 4 1 1
54