Task 30

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

Sample test

Input
2
1000000006 3
1000000003 999999998

Output is validated by a special checker; any valid answer is accepted.