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