A,N=map(int,input().split()) M=12345678 print(M) print(pow(A,N,M))