{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eA Gaussian integer is a complex number with integer components.\r\nIf \u003ci\u003ea\u003c/i\u003e, \u003ci\u003eb\u003c/i\u003e, \u003ci\u003eq\u003c/i\u003e, \u003ci\u003er\u003c/i\u003e are Gaussian integers, \u003ci\u003ea\u003c/i\u003e \u003d \u003ci\u003ebq\u003c/i\u003e + \u003ci\u003er\u003c/i\u003e, and |\u003ci\u003er\u003c/i\u003e| \u0026lt; |\u003ci\u003eb\u003c/i\u003e|, then \u003ci\u003er\u003c/i\u003e\r\nis a \u003ci\u003eremainder\u003c/i\u003e of division of \u003ci\u003ea\u003c/i\u003e by \u003ci\u003eb\u003c/i\u003e.\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eLet \u003ci\u003ep\u003c/i\u003e be a Gaussian integer and \u003ci\u003eX\u003c/i\u003e \u003d (\u003ci\u003ex\u003c/i\u003e\u003csub\u003e\u003ci\u003eij\u003c/i\u003e\u003c/sub\u003e) be a matrix of size \u003ci\u003en\u003c/i\u003e × \u003ci\u003en\u003c/i\u003e where all \u003ci\u003ex\u003c/i\u003e\u003csub\u003e\u003ci\u003eij\u003c/i\u003e\u003c/sub\u003e are Gaussian integers too. Your goal is to calculate the remainder of division of determinant of \u003ci\u003eX\u003c/i\u003e by \u003ci\u003ep\u003c/i\u003e. Remember, that the determinant of \u003ci\u003eX\u003c/i\u003e\r\nis equal to\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_centered_picture\"\u003e\u003cimg src\u003d\"CDN_BASE_URL/2c204b0329580e9497907b0ca72d44d1?v\u003d1715362977\" border\u003d\"0\" alt\u003d\"Problem illustration\"\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003ewhere the summation is taken over the set of all permutations of \u003ci\u003en\u003c/i\u003e elements.\r\nHere addition and multiplication are the usual addition and multiplication of complex numbers.\u003c/div\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eThe first line contains an integer \u003ci\u003en\u003c/i\u003e (1 ≤ \u003ci\u003en\u003c/i\u003e ≤ 50). Each of the next \u003ci\u003en\u003c/i\u003e lines contains \u003ci\u003en\u003c/i\u003e space-separated complex\r\nnumbers which are the elements of \u003ci\u003eX\u003c/i\u003e. The last line contains a non-zero complex number \u003ci\u003ep\u003c/i\u003e. Complex number is denoted by\r\nits real and imaginary parts, separated with space. All components of all complex numbers don\u0027t exceed 10\u0026nbsp;000 in their absolute value.\u003c/div\u003e\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eOutput real and imaginary parts of the remainder of division of determinant of \u003ci\u003eX\u003c/i\u003e by \u003ci\u003ep\u003c/i\u003e.\r\nIf there are several possible answers, output any of them. It is guaranteed that the answer exists.\u003c/div\u003e\u003c/div\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n2 0 -7 0\r\n1 0 0 -1\r\n3 1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3 0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}