determinant

(256000 kilobytes, 1000 milliseconds)

Submissions: 0 · Accepted: 0

Submit code

Statement

Determinant modulo (p)

Work in

\[ \mathbb F_p,\qquad p=1\,000\,000\,007. \]

Given an (n\times n) matrix (A), compute its determinant

\[ \det(A)\pmod p. \]

Input

The first line contains (n). The next (n) lines contain (A).

Output

Print one integer equal to (det(A)) modulo (p). Any integer
representative of the residue is accepted.

Constraints