Alice, 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:
We denote k!:
We denote S:
Then Smodulen is ____________
You are given an integer n.
You have to calculate Smodulon.
The first line contains an integer T(T≤1000), denoting the number of test cases.
For each test case, there is a line which has an integer n.
It is guaranteed that 2≤n≤1018.
For each test case, print an integer Smodulon.
The first test is: S=1×1!=1, and 1modulo 2 is1.
The second test is: S=1×1!+2×2!=5, and 5modulo3 is2.