a,n = map(int,input().split()) b=10**7 i = 0 while i < n: if a**i >= b: break i += 1 if a**i < b: print(b) print(a**n) else: print(a**i) print(0)