a,b=map(int,input().split()) for i in range(b): if a**i>=10**7: print(a**i) print(0) exit() print(10**7+1) print(a**b)