{"raw_statement":[{"iden":"statement","content":"A pair (p, q) of integer numbers is called Rasta - lover if and only if 1 ≤ p, q < n and there is a positive integer like x such that:\n\npx ≡ q (modn)\n\nSubtasks 1 - 3: \n\nGiven n, calculate the number of Rasta - lover pairs modulo 109 + 7.\n\nSubtasks 4 - 6:\n\nA positive integer p is called n - Rastaly if and only if p < n and there is a positive integer like x such that px ≡ 1 (modn) and p and n are coprimes.\n\nFor a positive integer n, f(n) is the smallest positive integer a such that for each n - Rastaly number like p, pa ≡ 1 (modn) (this number always exists).\n\nIf M is equal to  for a given A, then you have to calculate M modulo 109 + 7.\n\nSubtasks:\n\nEach subtask consists of one testcase.\n\nInput consists of one number. For subtasks 1-3, it's n and for subtasks 4-6 it's A.\n\nPrint the answer modulo 109 + 7 in one line.\n\n"},{"iden":"input","content":"Each subtask consists of one testcase.Input consists of one number. For subtasks 1-3, it's n and for subtasks 4-6 it's A."},{"iden":"output","content":"Print the answer modulo 109 + 7 in one line."},{"iden":"examples","content":""}],"translated_statement":[{"iden":"statement","content":"一对整数 #cf_span[(p, q)] 被称为 #cf_span[Rasta - lover]，当且仅当 #cf_span[1 ≤ p, q < n] 且存在一个正整数 #cf_span[x] 使得：\n\n#cf_span[px ≡ q] #cf_span[(modn)]\n\n子任务 #cf_span[1 - 3]：\n\n给定 #cf_span[n]，计算 #cf_span[Rasta - lover] 对的数量，对 #cf_span[109 + 7] 取模。\n\n子任务 #cf_span[4 - 6]：\n\n一个正整数 #cf_span[p] 被称为 #cf_span[n - Rastaly]，当且仅当 #cf_span[p < n] 且存在一个正整数 #cf_span[x] 使得 #cf_span[px ≡ 1] #cf_span[(modn)]，并且 #cf_span[p] 与 #cf_span[n] 互质。\n\n对于正整数 #cf_span[n]，#cf_span[f(n)] 是最小的正整数 #cf_span[a]，使得对于每个 #cf_span[n - Rastaly] 数 #cf_span[p]，都有 #cf_span[pa ≡ 1] #cf_span[(modn)]（这样的数总是存在）。\n\n如果给定 #cf_span[A] 时 #cf_span[M] 等于 ，则你需要计算 #cf_span[M] 对 #cf_span[109 + 7] 取模的结果。\n\n子任务：\n\n每个子任务包含一个测试用例。\n\n输入包含一个数字。对于子任务 1-3，它是 #cf_span[n]；对于子任务 4-6，它是 #cf_span[A]。"},{"iden":"input","content":"每个子任务包含一个测试用例。输入包含一个数字。对于子任务 1-3，它是 #cf_span[n]；对于子任务 4-6，它是 #cf_span[A]。"},{"iden":"output","content":"请在一行中输出对 #cf_span[109 + 7] 取模后的答案。"},{"iden":"examples","content":""}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions:**\n\nLet $ n \\in \\mathbb{Z}^+ $.\n\n- Let $ R(n) = \\left\\{ (p, q) \\in \\mathbb{Z}^2 \\mid 1 \\leq p, q < n \\text{ and } \\exists x \\in \\mathbb{Z}^+ \\text{ s.t. } p^x \\equiv q \\pmod{n} \\right\\} $.\n\n- Let $ S(n) = \\left\\{ p \\in \\mathbb{Z}^+ \\mid 1 \\leq p < n,\\ \\gcd(p, n) = 1,\\ \\exists x \\in \\mathbb{Z}^+ \\text{ s.t. } p^x \\equiv 1 \\pmod{n} \\right\\} $.\n\n- Define $ f(n) = \\min \\left\\{ a \\in \\mathbb{Z}^+ \\mid \\forall p \\in S(n),\\ p^a \\equiv 1 \\pmod{n} \\right\\} $.\n\n---\n\n**Given:**\n\n- For subtasks 1–3: Input is $ n $. Output $ |R(n)| \\mod (10^9 + 7) $.\n\n- For subtasks 4–6: Input is $ A $. Output $ f(A) \\mod (10^9 + 7) $.\n\n---\n\n**Formal Output:**\n\n$$\n\\boxed{\n\\begin{cases}\n|R(n)| \\mod (10^9 + 7) & \\text{if input is } n \\text{ (subtasks 1–3)} \\\\\nf(A) \\mod (10^9 + 7) & \\text{if input is } A \\text{ (subtasks 4–6)}\n\\end{cases}\n}\n$$","simple_statement":null,"has_page_source":false}