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