rhezo-and-big-powers-1

Rhezo likes numbers of the form A^B. But computing A^B, for any 2 numbers A and B is a hard task for him. He would like you to help him out in this.

Input:
First line of input contains a single integer A. Second line contains the integer B.

Output:
Help Rhezo find A^B. As this number can be large, print it modulo 10^9+7.

Constraints:
 1 ≤ A ≤ 10^9  
 1 ≤ B ≤ 10^{10^5} 

SAMPLE INPUT
4
3

SAMPLE OUTPUT
64

Source: hackerearth | Difficulty: EASY
Tags: Number theory

Mathematics


Solutions:
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''

mod = 1000000007
print(pow(eval(input()), eval(input()), mod))



z=int(input())
k=int(input())
print(pow(z,k,1000000007))


a=int(input())
b=int(input())
mod=10**9+7
print(pow(a,b,mod))



def findPowMod(A,B,M):
	if(B==0):
		return 1
	#print A,B,M
	res=findPowMod(A,B/2,M)
	if(B%2==0):
		return (res*res)%M
	else:
		return (A*res*res)%M


a=int(input())
b=int(input())
mod=10**9+7
#print findPowMod(a,b,mod)
print(pow(a,b,mod))



a = eval(input())
b = eval(input())
c = pow(a,b , 1000000007)
print(c)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''

mod = 1000000007
a = int(input().strip())
b = int(input().strip())
print(pow(a, b, mod )) 



a=int(input())
b=int(input())

print(pow(a,b,1000000007))


MOD = 1000000007

''''
def power(a,b):
	if(b==0):
		return 1
	temp = power(a, b/2)
	if(b%2 == 0):
		return temp*temp
	else:
		return a*temp*temp
'''

if __name__ == "__main__":
	try:
		A = int(eval(input()))
		B = int(eval(input()))
		print((pow(A,B,MOD)))
	except Exception as e:
		print(e)


A = int(input())
B = int(input())
print(pow(A, B, 1000000007))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
a = int(input())
b = int(input())
print(pow(a, b, 1000000007))


import math
n = int(input())
m = int(input())
mod = 1000000007

print(pow(n,m,mod))


MOD = 1000000007

''''
def power(a,b):
	if(b==0):
		return 1
	temp = power(a, b/2)
	if(b%2 == 0):
		return temp*temp
	else:
		return a*temp*temp
'''

if __name__ == "__main__":
	try:
		A = int(eval(input()))
		B = int(eval(input()))
		print((pow(A,B,MOD)))
	except Exception as e:
		print(e)


a=int(input())
b=int(input())

print(pow(a,b,10**9+7))


def f(g_base,a,p_mod):
	x=1
	bits = "{0:b}".format(a)
	for i, bit in enumerate(bits):
		if bit=='1': x = (((x**2)*g_base)%p_mod)
		elif bit=='0': x = ((x**2)%p_mod)
	return x%p_mod
	
A = int(input())
B = int(input())
res = f(A, B, 1000000007)
print(int(res))



def LargeNo():
	a = int(input())
	b = int(input())
    #No = [int(i) for i in raw_input().strip().split()]
	print(pow(a,b,(10**9 + 7)))
if __name__ == '__main__':
    LargeNo()


print(pow(eval(input()),eval(input()),(10**9+7)))


z=int(input())
k=int(input())
print(pow(z,k,1000000007))


a = eval(input())
b = eval(input())

print(pow(a,b,1000000007))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
a = int(input())
b = int(input())
print(pow(a, b, 1000000007))


MOD = int(1000000007)
'''
def fastpow(a,b):
	if b == 0:
		return 1
	if b == 1:
		return a%MOD
	d = fastpow(a, b/2)
	if b%2 == 0:
		return (d*d)%MOD
	else:
		return (((a*d)%MOD)*d)%MOD
'''
a = int(input())
b = int(input())

print(pow(a,b,MOD))








x=eval(input())
y=eval(input())
MOD=1000000007
ans=pow(x,y,MOD)
print(ans)


a=int(eval(input()))
b=int(eval(input()))

print((pow(a,b,1000000007)))