#P1226. Modular Exponentiation

    ID: 14367 Type: Default 1000ms 256MiB

Modular Exponentiation

Modular Exponentiation

Given three integers a, b, and p, compute the value of \(a^b \bmod p\).

inputFormat

The input consists of three integers a, b, and p separated by spaces.

outputFormat

Output a single integer representing \(a^b \bmod p\).

sample

2 10 1000
24