cielseven's picture
add benchmark corpora, groundtruth, symexec scripts and coverage docs
bff4ec7
|
Raw History Blame Contribute Delete
508 Bytes

P1226 — Fast Modular Exponentiation

Description

Given three integers $a$, $b$, and $p$, compute

ab  p. a^b \bmod p.

Input

The only line contains three integers $a$, $b$, and $p$.

Output

Print one line in the following format:

a^b mod p=s

Here a, b, and p are the input values, and $s=a^b\bmod p$.

Constraints

  • $0 \le a,b < 2^{31}$.
  • $a+b>0$.
  • $2 \le p < 2^{31}$.

Source

Luogu P1226, "Fast Modular Exponentiation".