{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eAlice, a student of grade $6$, is thinking about an Olympian Math problem, but she feels so despair that she cries. And her classmate, Bob, has no idea about the problem. Thus he wants you to help him. The problem is:\u003c/p\u003e\u003cp\u003eWe denote $k!$: \u003c/p\u003e\u003cp\u003e$k! \u003d 1 \\times 2 \\times \\cdots \\times (k - 1) \\times k$\u003c/p\u003e\u003cp\u003eWe denote $S$: \u003c/p\u003e\u003cp\u003e$S \u003d 1 \\times 1! + 2 \\times 2! + \\cdots +$\u003cbr\u003e$ (n - 1) \\times (n-1)!$\u003c/p\u003e\u003cp\u003eThen $S$ module $n$ is $____________$\u003c/p\u003e\u003cp\u003eYou are given an integer $n$. \u003c/p\u003e\u003cp\u003eYou have to calculate $S$ modulo $n$.\u003c/p\u003e\u003ch3\u003eInput\u003c/h3\u003e\u003cp\u003eThe first line contains an integer $T(T \\le 1000)$, denoting the number of test cases. \u003c/p\u003e\u003cp\u003eFor each test case, there is a line which has an integer $n$.\u003c/p\u003e\u003cp\u003eIt is guaranteed that $2 \\le n\\le 10^{18}$.\u003c/p\u003e\u003ch3\u003eOutput\u003c/h3\u003e\u003cp\u003eFor each test case, print an integer $S$ modulo $n$.\u003c/p\u003e\u003ch3\u003eHint\u003c/h3\u003e\u003cp\u003eThe first test is: $S \u003d 1\\times 1!\u003d 1$, and $1$ modulo $2$ is $1$.\u003c/p\u003e\u003cp\u003eThe second test is: $S \u003d 1\\times 1!+2 \\times 2!\u003d 5$ , and $5$ modulo $3$ is $2$.\u003c/p\u003e"}},{"title":"Sample 1","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\n2\n3\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n2\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr /\u003e"}}]}