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