#P5686. [CSP-S 2019 江西] 和积和
[CSP-S 2019 江西] 和积和
Background
JXCSP-S T2
Problem Description
Given two sequences indexed from to , define the function as:
Please compute the value of the following expression:
Since the answer may be very large, you only need to output the result modulo .
Input Format
The first line contains a positive integer indicating the length of the sequences.
The second line contains positive integers representing .
The third line contains positive integers representing .
Output Format
Output a single integer, the result modulo .
3
2 3 4
3 4 5
244
5
11 22 33 44 55
12 34 56 78 90
201542
Hint
Constraints
For of the testdata: , .
For of the testdata: , .
For of the testdata: , .
For of the testdata: , .
Translated by ChatGPT 5