HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Unsorted > problem:


A to the power of B

Section problems

• SAME OR DIFFERENT
• Binary to decimal
• Decimal to binary
• How many divisors?
• Find the biggest 2
• Find the biggest 3
• Tower of Happiness
• Going to the Movies
• A to the power of B
• X to the power of Y
• Connected components
• Arithmetic Operators
• REVERSE ORDER OF WORDS
• A Palace with Many Columns
• Nameplates
• Cycle detection
• Cities and roads

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 1000/1000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.

Problem description

Given three numbers a, b and n. Calculate ab mod n (ab % n) .

Input

In a single line of input given three numbers a, b and n (0 < a, n < 1001; 0 < b < 231).

Output

Write the value of ab mod n (ab % n).

Example

stdin stdout

2 5 1000

32

 

Для отправки решений необходимо выполнить вход.

www.contester.ru