Very Simple Sum

아직 제출이 없습니다시간 제한3초메모리 제한256 MB

문제

You are given two arrays aa and bb, each consisting of nn integers. Your task is to calculate a very simple sum: _1xn_1yn_1zn_1wn(a_x+a_y+a_z+a_w)(b_xb_yb_zb_w)mod998244353\sum\_{1 \le x \le n} \sum\_{1 \le y \le n} \sum\_{1 \le z \le n} \sum\_{1 \le w \le n} (a\_x + a\_y + a\_z + a\_w)^{(b\_x \oplus b\_y \oplus b\_z \oplus b\_w)} \mod 998244353

입력

First line contains a single integer nn --- the number of elements in arrays aa and bb.

Second line contains nn space-separated integers a_ia\_i --- the elements of the array aa.

Third line contains nn space-separated integers b_ib\_i --- the elements of the array bb.

출력

Output a single integer --- the value of the very simple sum.

제한

  • 1n1051 \le n \le 10^5
  • 1a_i,b_i5001 \le a\_i, b\_i \le 500