So far, we have only heard of Python's powers. Now, we will witness them!  

Powers or exponents in Python can be calculated using the built-in power function. Call the power function $a^{b}$ as shown below:  

>>> pow(a,b) 

or 

>>> a**b

It's also possible to calculate $a^b\mod m$.  

>>> pow(a,b,m)  

This is very helpful in computations where you have to print the resultant % mod.  

Note: Here, $\boldsymbol{a}$ and $\boldsymbol{b}$ can be floats or negatives, but, if a third argument is present, $\boldsymbol{b}$ cannot be negative.  

Note: Python has a math module that has its own pow(). It takes two arguments and returns a float. It is uncommon to use math.pow().  

Task 

You are given three integers: $\boldsymbol{a}$, $\boldsymbol{b}$, and $m$. Print two lines. 

On the first line, print the result of pow(a,b). On the second line, print the result of pow(a,b,m).  

Input Format 

The first line contains $\boldsymbol{a}$, the second line contains $\boldsymbol{b}$, and the third line contains $m$.  

Constraints 

$1\leq a\leq10$ 

$1\leq b\leq10$ 

$2\leq m\leq1000$  

Sample Input  

3
4
5

Sample Output  

81
1

Source: hackerrank | Difficulty: EASY
Tags: Mathematics


Solutions:
(a, b, m) = (int(input()), int(input()), int(input()))
print(a ** b)
print(pow(a, b, m))


a = int(input())
b = int(input())
c = int(input())
print(pow(a, b))
print(pow(a, b, c))


import sys
a = int(input())
b = int(input())
m = int(input())
if min(a, b) < 1 or max(a, b) > 10 or m < 2 or (m > 1000):
	sys.exit()
print(a ** b)
print(pow(a, b, m))


a = int(input())
b = int(input())
m = int(input())
print(pow(a, b))
print(pow(a, b, m))


a = int(input())
assert a >= 1 and a <= 10
b = int(input())
assert b >= 1 and b <= 10
m = int(input())
assert m >= 2 and m <= 1000
print(pow(a, b))
print(pow(a, b, m))


import math
a = int(input())
b = int(input())
m = int(input())
c = int(math.pow(a, b))
d = int(c % m)
print(c)
print(d)


a = int(input())
b = int(input())
m = int(input())
c = a ** b
d = c % m
print(c)
print(d)


a = int(input())
b = int(input())
m = int(input())
print(str(pow(a, b)) + '\n' + str(pow(a, b, m)))


(a, b, m) = (int(input()), int(input()), int(input()))
print(pow(a, b))
print(pow(a, b, m))


a = int(input())
b = int(input())
m = int(input())
c = pow(a, b)
print(c)
d = pow(a, b, m)
print(d)


a = int(input())
b = int(input())
m = int(input())
if a >= 1 and a <= 10:
	if b >= 1 and b <= 10:
		if m >= 2 and m <= 1000:
			power = pow(a, b)
			pow_mod = pow(a, b, m)
print(power)
print(pow_mod)


import math
a = int(input())
b = int(input())
c = int(input())
print(str(a ** b))
print(str(a ** b % c))


num1 = int(input())
num2 = int(input())
num3 = int(input())
number = pow(num1, num2, num3)
print(num1 ** num2)
print(number)


a = int(input())
b = int(input())
m = int(input())
while a < 1 or a > 10:
	a = int(input())
while b < 1 or b > 10:
	b = int(input())
while m < 2 or m > 1000:
	m = int(input())
print(pow(a, b))
print(pow(a, b, m))


x = int(input())
y = int(input())
m = int(input())
print(pow(x, y))
print(pow(x, y, m))


a = int(input())
b = int(input())
m = int(input())
import math
print(a ** b)
print(pow(a, b, m))


def test_range(a, b, m):
	return (a and b) > 0 and (a and b) <= 10 and (m > 1) and (m <= 1000)
a = int(input())
b = int(input())
m = int(input())
if test_range(a, b, m):
	print(pow(a, b))
	print(pow(a, b, m))


num1 = int(input())
num2 = int(input())
num3 = int(input())
print(pow(num1, num2))
print(pow(num1, num2, num3))


a = int(input())
b = int(input())
c = int(input())
print(a ** b)
print(pow(a, b, c))


a = int(input())
b = int(input())
c = int(input())
if (a >= 1 & a <= 10) & (b >= 1 & b <= 10) & (c >= 2 & c <= 1000):
	x = pow(a, b)
	y = pow(a, b, c)
	print(x)
	print(y)


n1 = int(input())
n2 = int(input())
n3 = int(input())
print(pow(n1, n2))
print(pow(n1, n2, n3))


a = int(input())
b = int(input())
m = int(input())
print(a ** b)
print(pow(a, b, m))


import sys
lines = sys.stdin.read()
(a, b, m) = [int(n) for n in lines.split()]
print(pow(a, b))
print(pow(a, b, m))


(a, b, m) = map(lambda x: int(input()), range(3))
print(pow(a, b))
print(pow(a, b, m))


a = int(input())
b = int(input())
m = int(input())
p = a ** b
print(int(p))
while p > m:
	p -= m
print(int(p))


a = int(input())
b = int(input())
m = int(input())
print(a ** b)
k = a ** b
print(k % m)


a = int(input())
b = int(input())
m = int(input())
print(str(pow(a, b)))
print(str(pow(a, b, m)))


a = int(input())
b = int(input())
c = int(input())
d = a ** b
print(d)
print(d % c)


def __starting_point():
	a = int(input().strip())
	b = int(input().strip())
	m = int(input().strip())
	print(pow(a, b))
	print(pow(a, b, m))
__starting_point()


import math
a = input()
b = input()
m = input()
a = int(a)
b = int(b)
m = int(m)
print(a ** b)
print(pow(a, b, m))


a = int(input())
b = int(input())
m = int(input())
print(a ** b)
print(a ** b % m)


number_1 = int(input())
number_2 = int(input())
number_3 = int(input())
result_1 = number_1 ** number_2
result_2 = result_1 % number_3
print(result_1)
print(result_2)


l = []
for x in range(3):
	l.append(int(input()))
[a, b, m] = l
print(pow(a, b))
print(pow(a, b, m))


a = eval(input())
b = eval(input())
m = eval(input())
print(pow(a, b))
print(pow(a, b, m))


a = int(input())
b = int(input())
m = int(input())
if 1 <= a <= 10 and 1 <= b <= 10 and (2 <= m <= 1000):
	print(pow(a, b))
	print(pow(a, b, m))


(a, b, m) = (int(input()), int(input()), int(input()))
print(pow(a, b), pow(a, b, m), sep='\n')