a,n = map(int,input().split()) m = 10**8 print(m) print((a**n)%m)