Problem H. Product of coprimes

时间限制 1000 ms   内存限制 32 MB

You are given a positive integer m. Calculate the product of all positive integers less then or equal to m and coprime with m, and give the answer modulo m.
 

输入数据

There are multiple tests end with EOF, each test contains only a positive integer m ≤ 10^9 in a line. The number of tests is no more than 5000.
 

输出数据

In the output file you should write the answer to the task.
 

样例输入

复制
1
2
3
4
5
6
7

样例输出

复制
0
1
2
3
4
5
6

提交

请先 登录

© 2025 FAQs Contact About