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