#P1054H. Epic Convolution
Epic Convolution
No submission language available for this problem.
Description
You are given two arrays and , and an integer .
Compute the following sum:
Since it's value can be really large, print it modulo .
First line contains three integers , and (, ).
Next line contains exactly integers and defines the array ().
Last line contains exactly integers and defines the array ().
Print one integer — value of the sum modulo .
Input
First line contains three integers , and (, ).
Next line contains exactly integers and defines the array ().
Last line contains exactly integers and defines the array ().
Output
Print one integer — value of the sum modulo .
Samples
Note
In the first example, the only non-zero summand corresponds to , and is equal to .
In the second example, all summands are equal to .