#P3508. Product of coprimes

    ID: 2392 远端评测题 1000ms 32MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>2010 ACM-ICPC Multi-University Training Contest(8)——Host by ECNU

Product of coprimes

Problem Description

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.

Input

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.

Output

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