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