Planet#3696

Planet

2 saniye
256 megabayt
Zor

Ordinary -dimensional kittens reside in cities on a unique planet, which is shaped like an -dimensional parallelepiped in -dimensional space. The edges of this parallelepiped align with the vectors v_1, \ldots, v_n, each having integer coordinates, and their lengths correspond to the lengths of these vectors.

Every point with integer coordinates, whether inside or on the boundary of this planet, hosts a city. For each (0 \le k \le n), a city is home to 2^k kittens if it lies within a -dimensional face of the parallelepiped. Additionally, either k = 0, or the city is not situated within any (k-1)-dimensional face of the parallelepiped.

Your task is to compute the total number of -dimensional kittens living on this planet. Given that this number can be extremely large, you need to provide the remainder when this number is divided by a specified prime number .

Giriş

The first line of the input file contains the numbers and (2 \le n \le 50, 2 \le p \le 10007). The following lines describe the vectors v_i. Each line contains integers a_{ij} (0 \le a_{ij} < p) — the coordinates of vector v_i. It is guaranteed that these vectors are linearly independent.

Çıktı

Output a single number — the remainder of the total number of kittens divided by .

Örnekler

Örnek 1

Loading
Loading