Determinant Strikes Back

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

Dinara has an integer xx and two nn arrays a_1,,a_na\_1, \dots, a\_n, b_1,,b_nb\_1, \dots, b\_n. She makes an n×nn \times n matrix MM 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 MM modulo (109+7)(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 nn and xx. The second line contains nn integers a_1,,a_na\_1, \dots, a\_n. The third line contains nn integers b_1,,b_nb\_1, \dots, b\_n.

출력

For each test case, print an integer which denotes the result.

제한

  • 1n1051 \leq n \leq 10^5
  • 0x,a_i,b_i1090 \leq x, a\_i, b\_i \leq 10^9
  • The sum of nn does not exceed 10610^6.