Problem:
Power For given integers m and n , compute m n (mod 1,000,000,007). Here, A (mod M ) is the remainder when A is divided by M . Input  m  n  Two integers m and n are given in a line. Output Print m n (mod 1,000,000,007) in a line. Constraints  1 ≤ m ≤ 100  1 ≤ n ≤ 10 9  Sample Input 1 2 3 Sample Output 1 8 Sample Input 2 5 8 Sample Output 2 390625

Solution (Python):
n,m=map(int,input().split())

print(pow(n,m,int(1e9+7)))

Solution (Python):
print(pow(*map(int,input().split()),10**9+7))

Solution (Python):
m,n=map(int,input().split())
bitn=format(n,'b')
flag=[0]*len(bitn)
flag[0]=m
for i in range(1,len(bitn)):
    flag[i]=(flag[i-1]**2)%1000000007
ans=1
bitn=bitn[::-1]
for i in range(len(bitn)):
    if bitn[i]=='1':
        ans=(ans*flag[i])%1000000007
print(ans)

Solution (Python):
m, n = map(int, input().split())
print(pow(m, n, 10**9 + 7))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m, n = map(int, input().split())
print(pow(m, n, 1000000007))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
import sys

MOD = 1000000007

def pow_mod(m, n):
    if n == 1:
        return m % MOD
    else:
        tmp = pow_mod(m, n / 2)
        if n % 2 == 0:
            return tmp * tmp % MOD
        else:
            return tmp * tmp * m % MOD
    
if __name__ == '__main__':
    line = sys.stdin.readline()
    m, n = line.split()
    m, n = int(m), int(n)
    
    sys.stdout.write(str(pow_mod(m, n)) + '\n')

Solution (Python):
def power(m, n):
    if n:return power(m * m % 1000000007, n // 2) * (m if n % 2 else 1) % 1000000007
    return 1


from sys import stdin
readline = stdin.readline

m, n = map(int, readline().split())
print(power(m, n))

Solution (Python):
def pos(x,n,M):
    if n==0:
        return 1
    res = pos(x*x%M, n /2, M)
    if n%2 ==1:
        res = res * x%M
    return res
 
m,n = map(int,raw_input().split())
 
print pos(m,n,1000000007)

Solution (Python):
m, n = map(int, input().split())
print(pow(m, n, 10**9+7))

Solution (Python):
try:
  while True:
    d = raw_input()
    d = map(int, d.split(" "))
    print pow(d[0], d[1], 1000000007)
except: pass

Solution (Python):
a, b = map(int, raw_input().split())
print pow(a, b, 1000000007)

Solution (Python):
def power(a, n, M):
    tmp = 1
    if n > 0:
        tmp = power(a, n/2, M)
        if n % 2 == 0:
            tmp =(tmp*tmp)%M
        else:
            tmp = (((tmp*tmp)%M)*a)%M
    return tmp
m, n = map(int, raw_input().split())
print power(m, n, 1000000007)

Solution (Python):
def power(a, n, M):
    if n == 0: return 1
    tmp = power(a*a%M, n/2, M)
    if n % 2 == 1:
        tmp = tmp * a % M
    return tmp
m, n = map(int, raw_input().split())
print power(m, n, 1000000007)

Solution (Python):
def power(a, n, M):
    res = 1
    if n > 0:
        res = power(a*a%M, n/2, M)
        if n % 2 == 1:
            res = res * a % M
    return res
m, n = map(int, raw_input().split())
print power(m, n, 1000000007)

Solution (Python):
m, n = map(int, input().split())
p, q, d = 1, m, 1000000007

while True:
    if n & 1:
        p *= q
        p %= d
    n >>= 1
    if not n:
        break
    q *= q
    q %= d

print(p)

Solution (Python):



if __name__ == "__main__":
    m, n = map(int, input().split())
    print(pow(m, n, 1000000007))

Solution (Python):
NUM = 1000000007

def power(m, n):
    if n == 0:
        return 1
    if n == 1:
        return m
    if n % 2 == 0:
        tmp = power(m, n/2) % NUM
        return tmp ** 2 % NUM
    if n % 2 == 1:
        tmp = power(m, n/2) % NUM
        return m * (tmp**2) % NUM

s = map(int, raw_input().split())
print "%d" % (power(s[0], s[1]) % NUM)

Solution (Python):
m,n=map(int, input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n = map(int,raw_input().split())
print pow(m,n,1000000007)

Solution (Python):
import sys
sys.setrecursionlimit(10**5)

def expsq(n,k):
    global mod

    if k==0:
        return 1
    elif k%2==0:
        return pow(expsq(n,k/2),2,mod)
    else:
        return expsq(n,k-1)*n%mod

m,n=map(int,raw_input().split())
mod=10**9+7
print(expsq(m,n)%mod)

Solution (Python):
import sys
sys.setrecursionlimit(10**5)

def expsq(n,k):
    global mod

    if k==0:
        return 1
    elif k%2==0:
        return pow(expsq(n,k/2),2,mod)
    else:
        return expsq(n,k-1)*n%mod

m,n=map(int,input().split())
mod=10**9+7
print(expsq(m,n)%mod)

Solution (Python):
print pow(*map(int, raw_input().split())+[10**9+7])

Solution (Python):
def power(n,m):
    if m == 0:
        return 1
    if m % 2 == 0:
        return power(n*n%1000000007,m//2)
    else:
        return n * power(n,m-1) % 1000000007
        
n,m = map(int, input().split())
print(power(n,m))

Solution (Python):
m,n = map(int, raw_input().split())
MOD = 1000000007
lst = [m]
i = 0
while True:
  lst.append(lst[i]*lst[i]%MOD)
  i += 1
  if i > 30:
    break

ans = 1
i = 0
while True:
  if n % 2 == 1:
    ans = ans * lst[i] % MOD
    n -= 1
  i += 1
  n /= 2
  if n == 0:
    break

print ans

Solution (Python):
D = 1000000007
m, n = [int(i) for i in input().split()]
print(pow(m,n,D))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):



"""
input:
5 8

output:
390625
"""

import sys


def mod_pow(x, n, _mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * x % _mod
        x = pow(x, 2) % _mod
        n >>= 1
    return res


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    n1, n2 = map(int, _input[0].split())
    M = 1000000007
    
    print(mod_pow(n1, n2, M))

Solution (Python):



"""
input:
5 8

output:
390625
"""

import sys


def mod_pow(x, n, _mod):
    res = 1
    while n > 0:
        
        if n % 2:
            res = res * x % _mod
        x = pow(x, 2) % _mod
        n //= 2
    return res


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    n1, n2 = map(int, _input[0].split())
    M = 1000000007
    
    print(mod_pow(n1, n2, M))

Solution (Python):
a,b=map(int,input().split())
print(pow(a,b,1000000007))

Solution (Python):
def mpow(x,n,mod):
    if n == 0:
        return 1
    if n % 4 == 0:
        return mpow((x**4)%mod,int(n/4),mod)
    elif n%4 == 1:
        return (mpow(x,int(n-1),mod)*x)%mod
    elif n%4 == 2:
        return (mpow(x,int(n-2),mod)*(x**2))%mod
    elif n%4 == 3:
        return (mpow(x,int(n-3),mod)*(x**3))%mod
n,m = map(int,input().split())
mod = 1000000007
print(mpow(n,m,mod))

Solution (Python):
m,n = map(int,input().split())

def amari(m,n):
    if n == 0:
        return 1
    
    if n % 2 == 0:
        return amari(m,n/2)**2%1000000007 
    else:
        return  m*amari(m,n-1)%1000000007 
print(amari(m,n))

Solution (Python):
m, n = map(int, input().split())
print(pow(m, n, 1000000007))

Solution (Python):
mod = 1000000007
m, n = map(int, input().split())
print(pow(m,n,mod))

Solution (Python):
A = list(map(int, input().split()))

m = A[0]
n = A[1]
M = 1000000007

def pos(m, n):
    if n == 0:
        return 1
    res = pos(m * m % M, int(n / 2))
    if n % 2 == 1:
        res *= m
        res = res % M
    return res

r = pos(m, n)
print(r)

Solution (Python):
def modpow(m, n, mod):
    if n == 0:
        return 1

    return ((modpow(m, n//2, mod)**2 % mod) * m**(n & 1)) % mod

mod = 10**9 + 7

m, n = map(int, input().split())

print(modpow(m, n, mod))

Solution (Python):
mod = 10**9 + 7
m, n = map(int, input().split())
print(pow(m, n, mod))

Solution (Python):
import sys

mod = 10**9 + 7

def solve():
    m, n = map(int, input().split())

    ans = modpow(m, n, mod)

    print(ans)

def modpow(x, y, mod):
    return ((modpow(x, y >> 1, mod)**2 % mod) * x**(y & 1)) % mod if y else 1

if __name__ == '__main__':
    solve()

Solution (Python):
import sys

mod = 10**9 + 7

def solve():
    m, n = map(int, input().split())

    ans = modpow(m, n, mod)

    print(ans)

def modpow(x, y, mod):
    res = 1

    while y:
        if y & 1:
            res = (res * x) % mod

        x = (x * x) % mod
        y >>= 1

    return res

if __name__ == '__main__':
    solve()

Solution (Python):
import sys

mod = 10**9 + 7

def solve():
    m, n = map(int, input().split())
    print(pow(m, n, mod))

if __name__ == '__main__':
    solve()

Solution (Python):
m, n = [int(_) for _ in raw_input().split()]
MOD = 1000000007




ans = 1
r = m
while n:
    if n & 1:
        ans = (ans * r) % MOD
    r = (r * r) % MOD
    n >>= 1

print ans

Solution (Python):
import math
a=1000000007

m,n=[int(i) for i in input().split(" ")]

pow_list=[m]
x=int(math.log2(n))
for i in range(x+1):
    pow_list.append((pow_list[-1]**2)%a)

result=1
for i in range(x+1):
    if n>=2**(x-i):
        n-=2**(x-i)
        result=(result*pow_list[x-i])%a

print (result)

Solution (Python):
m, n = map(int, input().split())
ans = 1
while n:
    ans = ans *(m if n%2 else 1) % 1000000007
    m = m*m%1000000007
    n>>=1
print(ans)

Solution (Python):
from sys import stdin
m, n = map(int, stdin.readline().split())
print(pow(m, n, 1000000007))

Solution (Python):
m, n = map(int, input().split())
print(pow(m, n, int(1e9) + 7))

Solution (Python):
def solve():
    m, n = map(int, input().split())
    print(pow(m, n, 1000000007))

solve()

Solution (Python):
def power(x, n, d):
    rem = 1
    if n > 0:
        rem = power(x, n // 2, d)
        if n % 2 == 0:
            rem = rem ** 2 % d
        else:
            rem = ((rem ** 2 % d) * x) % d
    return rem

def solve():
    m, n = map(int, input().split())
    print(power(m, n, 1000000007))

solve()

Solution (Python):
d = 1000000007

def pow_rem(x, n):
    if n == 0:
        return x ** n % d
    if n % 2 == 0:
        return pow_rem(x, n // 2) ** 2 % d
    else:
        return ((pow_rem(x , n // 2) ** 2) * x) % d

def solve():
    m, n = map(int, input().split())
    print(pow_rem(m, n))

solve()

Solution (Python):
C = 10**9 + 7
m, n = map(int, input().split())
print(pow(m, n, C))

Solution (Python):
def new_pow(x, n):
    C = 10**9+7
    
    if n == 0:
        return 1
    
    if n:
        return new_pow(x*x%C, n//2) * (x if n % 2 else 1) % C
    
m, n = map(int,input().split())
print(new_pow(m,n))

Solution (Python):


import itertools
import sys, math, os


PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input2.txt", "rt")

m, n = [int(_) for _ in input().split()]
mod = 1000000007
print(pow(m, n, mod))

Solution (Python):

m,n=(int(i) for i in input().split())
m2=1
while n>0:
    m1=m
    l=1
    while l*2<=n:
        m1*=m1
        if m1>1000000007:
            m1%=1000000007
 
        l*=2
    n-=l
    m2*=m1
    if m2>1000000007:
        m2%=1000000007

print(m2)

Solution (Python):
m,n = map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
print(int(pow(*map(int,input().split()),10**9+7)))

Solution (Python):
m, n = map(int, input().split())
print(pow(m, n, 1000000007))

Solution (Python):



def pow(x, n, M=1):
    if n == 0:
        return 1
    res = pow((x * x) % M, n // 2, M)
    if n % 2 == 1:
        res = (res * x) % M
    return res


if __name__ == '__main__':

    M = 1000000007
    m, n = map(int, input().split())
    print(pow(m, n, M))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n=map(int,raw_input().split())
M=10**9+7

def a(m,n):
	N=n
	ans=m
	c=1
	while n>1:
		ans=ans**2
		ans%=M
		n/=2
		c*=2

	N=N-c
	return ans,N


x=m; y=n

ans=1
while y>1:
	x,y=a(m,y)
	ans=(ans*x)%M

if y==1:
	print (ans*m)%M
else:
	print ans

Solution (Python):



m, n = [int(x) for x in input().split(' ')]
print(pow(m, n, 1000000007))

Solution (Python):
MAX = 1000000007

m, n = [int(x) for x in input().split(' ')]
bi_n = bin(n)

ans = 1
dig = m
for i in range(len(bi_n)-1, 1, -1):
    if bi_n[i] == '1': ans *= dig
    if ans >= MAX: ans %= MAX
    dig *= dig
    if dig >= MAX: dig %= MAX

print(ans)

Solution (Python):
m, n = map(int, input().split())
print(pow(m, n, int(1e9) + 7))

Solution (Python):
mod = 1000000007
l = input().split()
m = int(l[0])
n = int(l[1])


def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y/2)**2 % mod
    else:
        return power(x, int(y/2))**2 * x % mod


ans = power(m, n)
print(ans)

Solution (Python):
m,n=[ int(x) for x in input().split()]    
k=1000000007

REM={}

def remainder(i):

    if i in REM.keys():
        return REM[i]

    if i==1:
        re=m%k
        REM[1]=re     
        return re

    if i==2:
        re=(m%k)**2%k
        REM[2]=re        
        return re
    
    left=i//2
    right=i-left
    REM[i]=remainder(left)*remainder(right)%k
    return REM[i]


print(remainder(n))

Solution (Python):
m,n = map(int,input().split(" "))
print(pow(m,n,1000000007))

Solution (Python):
mod = 1000000007

def mod_power(a, n):
    if n == 0:
        return 1
    if n % 2:
        return a * mod_power(a, n - 1) % mod
    tmp = mod_power(a, n // 2)
    return tmp * tmp % mod


a, n = [int(i) for i in input().split()]
print(mod_power(a, n))

Solution (Python):
def main():
    m, n = [int(_) for _ in input().split()]
    print(pow(m, n, 1000000007))

main()

Solution (Python):
a, b = raw_input().split()
print pow(int(a), int(b), 1000000007)

Solution (Python):
m,n = map(int,raw_input().split())
print pow(m,n,1000000007)

Solution (Python):
l = 1000000007
n,m = map(int,raw_input().split())
print pow(n,m,l)

Solution (Python):
n,m = map(int,raw_input().split())
print pow(n,m,1000000007)

Solution (Python):
n,m = map(int,raw_input().split())
print pow(n,m,1000000007)

Solution (Python):
m, n = map(int, input().split())

print(pow(m, n, 1000000007))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n = map(int,input().split());
a = pow(m, n,1000000007)
print(a);

Solution (Python):
def A(x):
    mod=1000000007
    return(x%mod)
    
def B(a,b,mod):
    if b==1:
        return a
    elif b%2==0:
        a_2=A(a**2)
        b_2=b//2
        return A(B(a_2,b_2,mod))
    else:
        a_2=A(a**2)
        b_2=(b-1)//2
        return A(B(a_2,b_2,mod)*a)
        
mod=1000000007
m,n=map(int,input().split())

print(B(m,n,mod))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):

m,n=map(int,input().split())
a=1000000007
print(pow(m,n,a))

Solution (Python):
m,n=map(int,input().split())
mod=1000000007
res=1
while n>0:
    if n & 1 == 1:
        res=res*m%mod
    m=m*m%mod
    n>>=1
print(res)

Solution (Python):
m,n = map(int, input().split())
print(pow(m, n, 1000000007))

Solution (Python):
n ,m=map(int,input().split())
print(pow(n,m,1000000007))

Solution (Python):
mod = 1000000007
l = input().split()
m = int(l[0])
n = int(l[1])


def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y/2)**2 % mod
    else:
        return power(x, int(y/2))**2 * x % mod


ans = power(m, n)
print(ans)

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n = map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n=map(int,input().split())

e=pow(m,n,1000000007)
print(e)

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):



M = 1000000007
def func(x, y):
   if y == 0:
      return 1
   elif y % 2 == 0:
      return func((x * x) % M, y / 2)
   else:
      return (x * func(x, y - 1) % M)

m, n = map(int, input().split())
print(func(m, n))

Solution (Python):
z=1000000007
x,y=map(int,input().split())
s=pow(x,y,z)
print(s)

Solution (Python):
m,n=map(int,input().split())

print(pow(m,n,1000000007))

Solution (Python):
n, m = map(int, input().split())

MOD = 10**9 + 7

print(pow(n,m,MOD))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
import sys

input = sys.stdin.readline

P = 10 ** 9 + 7


def main():
    M, N = map(int, input().split())

    ans = pow(M, N, P)

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n=map(int,input().split())

print(pow(m,n,10**9+7))

Solution (Python):
from functools import lru_cache
@lru_cache(maxsize=None)

def power(a, b):
    res = 1
    
    if b > 0:
        res = power(a, b // 2)
        if b % 2 == 0:
            res = (res * res) % 1000000007
        else:
            res = (((res * res) % 1000000007) * a) % 1000000007
    
    return res
    
m, n = map(int, input().split())

print(power(m, n))

Solution (Python):
print(pow(*map(int, input().split()), 10**9+7))

Solution (Python):
m, n = map(int, input().split())

def mod_binary(base, exponent, modulo):
  mask = 1 << (exponent.bit_length() - 1)
  ans = 1
  while mask:
    ans = ans * ans % modulo
    if exponent & mask:
      ans = ans * base % modulo
    mask >>= 1
  return ans

print(mod_binary(m, n, 1000000007))

Solution (Python):


m, n = map(int, input().split())


def modpow(a, n, mod):
    ret = 1
    while n > 0:
        if n & 1:
            ret = ret * a % mod
        a = a * a % mod
        n >>= 1
    return ret


print(modpow(m, n, 10**9 + 7))

Solution (Python):
m,n = (int(x) for x in input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n = map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):


m, n = list(map(int, input().split()))


def modpow(a: int, b: int, mod: int) -> int:
    ans = 1
    while b > 0:
        if (b & 1):
            ans = ans * a % mod
        a = a * a % mod
        b >>= 1
    return ans

ans = modpow(m, n, 1000000007)


print(ans)

Solution (Python):
m,n = (int(x) for x in input().split())
print(pow(m, n, 1000000007))

Solution (Python):
m, n = map(int, input().split())
print(pow(m, n, int(1e9) + 7))

Solution (Python):
MOD = 10**9 + 7
a, b = list(map(int, input().split()))
print(pow(a, b, MOD))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):



MOD = 1000000007
m, n = map(int,input().split())
print(pow(m, n, MOD))

Solution (Python):
print(int(pow(*map(int,input().split()),10**9+7)))

Solution (Python):
kMod = 1000000007
m, n = map(int, input().split())

buf = {1:m}

i = 2

while i <= n:
    prev = buf[i // 2]
    cur = (prev * prev) % kMod
    buf[i] = cur
    i *= 2

ans = 1
i = 0
while (1 << i) <= n:
    if (1<<i) & n:
        ans *= buf[1<<i]
        ans %= kMod
    i += 1
print(ans)

Solution (Python):
m,n=map(int,input().split())
a=pow(m,n,1000000007)
print(a)

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N, M = map(int, readline().split())
    ans = pow(N, M, MOD)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n = map(int, input().split())
ans = pow(m,n,10**9+7)

print(ans)

Solution (Python):


m,n=map(int,input().split())
p=pow(m,n,1000000007)
print(p)

Solution (Python):
def powmod(m, n, p):
    pow = m
    ret = 1
    while n > 0:
        if n & 1:
            ret = ret * pow % p
        pow = (pow * pow) % p
        n >>= 1
    return ret

m, n = [int(x) for x in input().split()]
p = 10 ** 9 + 7
print(powmod(m, n, p))

Solution (Python):
m, n= map(int, input().split())
p = 1000000007
a = pow(m, n, p)

print(a)

Solution (Python):
m, n = map(int, input().split())
N = pow(m, n, 1000000007)
print(N)

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
n,m=map(int,input().split())
print(pow(n,m,1000000007))

Solution (Python):


m,n = map(int, input().split())

mod = 1000000007

ans = pow(m, n, mod)    

print(ans)

Solution (Python):
mod = 10**9+7
m, n =map(int, input().split())
print(pow(m,n,mod))

Solution (Python):
m, n = map(int, input().split())
print(pow(m, n, 10**9+7))

Solution (Python):
m,n = map(int,input().split())

print(pow(m,n, 1000000007))

Solution (Python):
m,n = map(int,input().split())
mod = 10**9+7
ans = pow(m,n,mod)
print(ans)

Solution (Python):
m,n = map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
n,m=map(int,input().split())
d=1000000007

print(pow(n,m,d))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,10**9+7))

Solution (Python):


MOD = 10 ** 9 + 7
m, n = list(map(int, input().split()))
print(pow(m, n, MOD))

Solution (Python):
m, n = map(int, input().split())
print(pow(m, n, 10 ** 9 + 7))

Solution (Python):
m,n=map(int,input().split())

print(pow(m,n,1000000007))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
def modpow(a, n, mod):
    res = 1
    while n > 0:
        if (n & 1):
            res = res * a % mod
        a = a * a % mod
        n = n >> 1

    return res


def main():
    m, n = map(int, input().split())
    print(modpow(m, n, 1000000007))


if __name__ == "__main__":
    main()

Solution (Python):
m,n = map(int,input().split())

amari = pow(m,n,1000000007)

print(amari)

Solution (Python):
import math

m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m, n = map(int,input().split())
print(pow(m, n, 1000000007))

Solution (Python):
m,n = map(int,input().split())
a = 1000000007

def keisan(x, y):
    if y == 1:
        return x % a
    elif y % 2 == 0:
        return keisan(x, y/2)**2 % a
    else:
        return keisan(x, int(y/2))**2 * x % a

if n < 5:
    print(m**n)
else:
    ans = keisan(m, n)
    print(ans)

Solution (Python):
mod = 10**9+7
m, n = map(int, input().split())
print (pow(m,n,mod))

Solution (Python):
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

m,n = mi()

mod = 1000000007

def modpow(m,n,mod=1000000007):
    res = 1
    while n>0:
        if n&1: res = res * m % mod
        m = m * m % mod
        n >>= 1
    return res

ans = modpow(m,n)

print(ans)

Solution (Python):
n,m=map(int,input().split());print(pow(n,m,10**9+7))

Solution (Python):
m, n = map(int, input().split())
mod = 10**9 + 7


def modpow(m, n, mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * m % mod
        m = m * m % mod
        n >>= 1
    return res


print(modpow(m, n, mod))

Solution (Python):
m,n=map(int,input().split())
mod=1000000007

x=bin(n)[2:]
lst=[m for i in range(len(x))]
for i in range(1,len(x)):
    lst[i]=lst[i-1]**2
    lst[i]%=mod

sm=1
for i,b in enumerate(x):
    if b=="1":
        sm*=lst[len(x)-1-i]
        sm%=mod

print(sm)

Solution (Python):
m, n = map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n = map(int,input().split())
print(pow(m,n, 1000000007))

Solution (Python):
m, n = map(int, input().split())

print(pow(m, n, 10**9 + 7))

Solution (Python):
def modpow(a,n,m):
  res=1
  while n>0:
    if n&1:res=res*a%m
    a=a*a%m
    n//=2
  return res
INF=10**9+7
n,m=map(int,input().split())
print(modpow(n,m,INF))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    m, n = map(int, input().split())
    print(pow(m, n, mod))


if __name__ == '__main__':
    resolve()

Solution (Python):
def p(m, n, r=1000000007):
    return pow(m, n, r)


if __name__ == '__main__':
    m, n = list(map(int, input().split()))
    print(p(m, n))

Solution (Python):
m,n = map(int,input().split())
print(pow(m,n,10**9+7))

Solution (Python):
m, n = map(int, input().split())
mod = 10**9+7
print(pow(m, n, mod))

Solution (Python):

import math
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n=map(int,input().split())

print(pow(m,n,1000000007))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
a,b=map(int,input().split())
    
c=pow(a,b,1000000007)
    
print(c)

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n=map(int, input().split())
k=1000000007

print(pow(m, n, k))

Solution (Python):
mod = 1000000007
l = input().split()
m = int(l[0])
n = int(l[1])


def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y/2)**2 % mod
    else:
        return power(x, int(y/2))**2 * x % mod


ans = power(m, n)
print(ans)

Solution (Python):



m,n = map(int,input().split())

print(pow(m, n, 1000000007))

Solution (Python):

m , n = map(int,input().split())
a = pow(m,n,1000000007)
print(a)

Solution (Python):
m,n=map(int,input().split())
print(pow(m, n, 1000000007))

Solution (Python):
import math
m, n = map(int,input().split())
x = pow(m, n, 1000000007)
print(x)

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m, n = map(int, input().split())
print(pow(m, n, 1000000007))

Solution (Python):
m,n = list(map(int,input().split()))
print(pow(m,n,1000000007))

Solution (Python):
a,b=map(int,input().split())
print(pow(a,b,1000000007))

Solution (Python):
def re(x, y):
    z = pow(x, y, 1000000007)
    print(z)
m, n = map(int,input().split())
re(m, n)

Solution (Python):
m,n=map(int,input().split())

div=10**9+7
def po(x,n,M):
    res=1
    if n>0:
        
        res= po(x,n//2,M)
    if n%2==0:
        res=(res*res)%M
    else:
        res=(((res*res)%M)*x)%M
        
      
    return res

print(po(m,n,div))

Solution (Python):
m, n = map(int, input().split())
print(pow(m, n, 10**9+7))

Solution (Python):
import sys
import itertools

import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

m, n = map(int, input().split())

MOD = 10 ** 9 + 7
def pow(a, b):
    c = 1
    while b > 1:
        if b % 2 == 0:
            b //= 2
            a *= a
        else:
            b -= 1
            c *= a
        a %= MOD
        c %= MOD
    return a * c
print(pow(m, n) % MOD)

Solution (Python):
def S(x) :
    mod = 1000000007
    return(x % mod)
    
def A(a, b, mod) :
    if b == 1 :
        return a
    elif b%2 == 0 :
        a_2 = S(a**2)
        b_2 = b // 2
        return S(A(a_2, b_2, mod))
    else :
        a_2 = S(a**2)
        b_2 = (b-1) // 2
        return S(A(a_2, b_2, mod)*a)
        
mod = 1000000007
m, n = map(int, input().split())

print(A(m, n, mod))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n = map(int,input().split())
MOD = 1000000007

def power(m,n):
    if n == 1:
        return m
    else:
        if n % 2 == 0:
            return (power(m,n//2)**2)%MOD
        else:
            return ((power(m,n//2)**2)*m)%MOD

print(power(m,n))

Solution (Python):
m, n = map(int, input().split())
mod = 10 ** 9 + 7


def my_pow(m, n, mod):
    
    if n == 1:
        return m
    if n % 2:
        return (m * my_pow(m, n // 2, mod) ** 2) % mod
    else:
        return (my_pow(m, n // 2, mod) ** 2) % mod


print(my_pow(m, n, mod))

Solution (Python):
n,m=map(int,input().split())
print(pow(n,m,1000000007))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m, n = map(int, input().split())
MOD = 1000000007
print(pow(m, n, MOD))

Solution (Python):
m, n = map(int, input().split())

mod = 10 ** 9 + 7


def modpow(m, n, mod):
    if n == 0:
        return 1

    if n % 2 == 0:
        return modpow(m, n // 2, mod) ** 2 % mod
    else:
        return modpow(m, n - 1, mod) * m % mod


print(modpow(m, n, mod) % mod)

Solution (Python):
m,n=map(int,input().split())
p=pow(m,n,1000000007)
print(p)

Solution (Python):
MOD=pow(10, 9)+7

def main():
    m, n = map(int, input().split())
    ans = pow(m, n, MOD)
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):

m,n = map(int, input().split())

def my_pow(m,n):
    res = 1
    while n > 0:
        if n&1:
            res = res * m
        m = m * m
        n >>= 1
    return res

def my_pow_mod(m,n,M):
    res = 1
    while n > 0:
        if n&1:
            res = res * m % M
        m = m * m % M
        n >>= 1
    return res

print(my_pow_mod(m,n,1000000007))

Solution (Python):
m, n = map(int, input().split())
inf = 1000000007

a = [m]
for i in range(30):
    m *= m
    m %= inf
    a.append(m)

ans = 1
i = 0
while(n>0):
    if n%2 == 1:
        ans *= a[i]
        ans %= inf
    n = n//2
    i += 1
    
print(ans)

Solution (Python):
def main():
    import sys
    M, N = map(int, sys.stdin.readline().split())
    mod = 10**9+7
    
    
    def calc(a,b, mod):
        if b==1:
            return a % mod
        if b %2==0:
            return calc(a**2%mod, b//2, mod) % mod
        elif b % 2==1:
            return a*calc(a, b-1, mod) % mod
            
    
    ans = calc(M, N, mod)
    print(ans)
    
    
    
if __name__=='__main__':
    main()

Solution (Python):

m,n =  map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n = map(int,input().split())
print(pow(m, n, 10**9+7))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m,n=map(int,input().split())
print(pow(m,n,1000000007))

Solution (Python):
m, n = map(int,input().split())
ans = pow(m,n,10**9+7)
print(ans)

Solution (Python):
def cal_expo(m, n, MOD):
    if m == 1:
        return 1
    ans = 1
    while n != 1:
        if n % 2 != 0:
            ans = (ans * m) % MOD
        n //= 2
        m = (m ** 2) % MOD
    ans = (ans * m) % MOD
    return ans


def main():
    m, n = map(int, input().split())
    MOD = 10 ** 9 + 7
    ans = cal_expo(m, n, MOD)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
m, n = map(int, input().split())
print(pow(m, n, 10**9 + 7))

Solution (Python):
m,n=map(int,input().split())

ans = pow(m,n,1000000007)


print(ans)

Solution (Python):
def mod_pow(a, n, mod):
    """
    二分累乗法による a^n (mod m)の実装
    :param a: 累乗の底
    :param n: 累乗の指数
    :param mod: 法
    :return: a^n (mod m)
    """

    result = 1
    a_n = a
    while n > 0:
        if n & 1:
            result = result * a_n % mod
        a_n = a_n * a_n % mod
        n >>= 1
    return result


MOD = 1000000007

M, N = map(int, input().split(' '))

print(mod_pow(M, N, MOD))

Solution (Python):
m, n = map(int, input().split())
print(pow(m, n, 1000000007))

Solution (Python):
m, n = map(int, input().split())
mod = 10**9+7
print(pow(m, n, mod))

Solution (Python):
mod = 1000000007
l = input().split()
m = int(l[0])
n = int(l[1])


def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y/2)**2 % mod
    else:
        return power(x, int(y/2))**2 * x % mod


ans = power(m, n)
print(ans)

Solution (Python):



M = 1000000007
def func(x, y):
   if y == 0:
      return 1
   elif y % 2 == 0:
      return func((x * x) % M, y / 2)
   else:
      return (x * func(x, y - 1) % M)

m, n = map(int, input().split())
print(func(m, n))

Solution (Python):
print(pow(*list(map(int,input().split())),10**9+7))