16 lines
250 B
Python
16 lines
250 B
Python
import math
|
|
import sys
|
|
|
|
def mod_exp(x, y, m):
|
|
k = x % m
|
|
for i in range(y):
|
|
print(i)
|
|
k = (k * x) % m
|
|
return k
|
|
|
|
line = sys.stdin.readline().split()
|
|
x = int(line[0])
|
|
y = int(line[1])
|
|
m = int(line[2])
|
|
|
|
print(mod_exp(x, y, m))
|