a, n = map(int, input().split()) print(10 ** 7) print(pow(a, n, 10**7))