Chino With Minimum
题号:NC222151
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Chino has an array a with  elements. Now she prepares  different arithmetic sequence. The first term of the  arithmetic sequence is , the tolerance is k_i, and the length of the sequence is exactly .

The element of  marked and marked with same position in respective array. The element in in Same position marked . is equal to minus . ( )

For each array , marked Minimum_i is the minimum element in c_i.

That is

Now Chino want to know for each different array b_i, what are the generated Minimum_i.

输入描述:

In the first line, input two integer  means the length of the array the numbers of arithmetic sequence.

In the next line, input non-negative integers

In the next  lines, input two integers

输出描述:

Output  lines, Represents each Minimum_i.
示例1

输入

复制
5 3
1 9 2 4 3
10 -1
1 100
403 -100

输出

复制
0
0
0

说明

b_1=\{10,9,8,7,6\},c_1= \{9,0,6,3,3\},The minimum value is {0}

b_2=\{1,101,201,301,401\},c_2= \{0,92,199,297,398\},The minimum value is {0}

b_3=\{403,303,203,103,3\},c_3= \{401,294,201,99,0\},The minimum value is {0}