Public Judge

pjudge

Limite de temps : 2 s Limite de mémoire : 512 MB Points totaux : 100

#21661. 【PR #7】Da Kai's Confusion

Statistiques

Given two positive integers $d$ and $k$, find the largest positive integer $x$ such that $x \mid ((a+d)^k - a^k)$ holds for all positive integers $a$.

Input

The first line contains two positive integers $d$ and $k$.

Output

Output a single positive integer representing the answer.

Examples

Input 1

2 2

Output 1

4

Input 2

84623 25861

Output 2

930853

Constraints

For all test cases, $1 \le d, k \le 10^{100}$.

Subtask ID Special Property Score
$1$ $d, k \le 10^7$ $20$
$2$ $\gcd(d, 210) = 1$ $30$
$3$ $d, k \le 10^{18}$ $30$
$4$ $20$

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.