시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 26 | 17 | 10 | 52.632% |
Dinara has an integer $x$ and two $n$ arrays $a_1, \dots, a_n$, $b_1, \dots, b_n$. She makes an $n \times n$ matrix $M$ where
$$ M_{i, j} = \left\{\begin{matrix} x + a_i b_j & \mathrm{when}\ i = j \\ a_i b_j & \mathrm{otherwise} \end{matrix}\right. $$
Find the determinant of the matrix $M$ modulo $(10^9+7)$.
The input consists of several test cases terminated by end-of-file.
The first line of each test case contains two integers $n$ and $x$. The second line contains $n$ integers $a_1, \dots, a_n$. The third line contains $n$ integers $b_1, \dots, b_n$.
For each test case, print an integer which denotes the result.
2 1 0 0 0 0 2 1 1000000000 1000000000 1000000000 1000000000 3 2 2 3 3 2 3 3
1 99 96