navigation switch
Home
Contests
Notification
Clarification
Problems
Ranklist
Status
HackStatus
Problem about GCD
Accepts: 5
Submissions: 143
Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 32768/32768 K (Java/Others)
Problem Description
Given integer m. Find multiplication of all 1<=a<=m such gcd(a, m)=1 (coprime with m) modulo m.
Input
Input contains multiple tests, one test per line. Last line contains -1, it should be skipped. [b][Technical Specification][/b] m <= 10^18
Output
For each test please output result. One case per line. Less than 160 test cases.
Sample Input
Copy
1 2 3 4 5 -1
Sample Output
Copy
0 1 2 3 4