def recursion(n, k):
if n == 1 or k == 0 :
return 1
elif n == -1:
if k%2==0:
return -n
else :
return n
elif k < 2:
return n
else:
return recursion(n, k-1) * n
n, k = input().split(' ')
n = int(n)
k = int(k)
result = recursion(n, k)
print(result)
알고리즘