题号:NC52777
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
Special Judge, 64bit IO Format: %lld
题目描述
Bobo computes the product
%20%5Ccdot%20Q(x)%20%3D%20c_0%20%2B%20c_1%20x%20%2B%20%5Cdots%20%2B%20c_%7Bn%20%2B%20m%7D%20x%5E%7Bn%20%2B%20m%7D)
for two polynomials
%20%3D%20a_0%20%2B%20a_1%20x%20%2B%20%5Cdots%20%2B%20a_n%20x%5En)
and
%20%3D%20b_0%20%2B%20b_1%20x%20%2B%20%5Cdots%20%2B%20b_m%20x%5Em)
.
Find
)
modulo
)
for given L and R.
输入描述:
The input consists of several test cases and is terminated by end-of-file.
The first line of each test case contains four integers n, m, L, R.
The second line contains (n+1) integers
.
The third line contains (m+1) integers
.
输出描述:
For each test case, print an integer which denotes the reuslt.
示例1
输入
复制
1 1 0 2
1 2
3 4
1 1 1 2
1 2
3 4
2 3 0 5
1 2 999999999
1 2 3 1000000000
备注:
* 
* 
* 
* Both the sum of n and the sum of m do not exceed
.