Modular Linear System Solver

Enter the augmented matrix (one equation per line, coefficients and constant separated by spaces) and a prime modulus. For example:

1 0 0 1
0 1 1 2