M=0x1000000 def f(a,n): if n<2: return a z=f(a,n>>1) z=a*z*z if n&1 else z*z return z&0xFFFFFF a,n=map(int,input().split()) print(M) print(f(a,n))