Exponentiation

Description

Calculate a ^ b\mod p.

Samples

input #1:

2 10 9
output #1:
7

Constraints

0 \leq a,b < 2^{31}, a+b>0, 1 < p < 2^{31}

Time Limit: 1.0s   |   Memory Limit: 128 MB

Practice Mode

💡 Tip: Press Ctrl + Enter (or ⌘ + Enter on Mac) to submit your code instantly.