# verification-helper: PROBLEM https://yukicoder.me/problems/no/2007 a, n = map(int, input().split()) print(10 ** 7) print(pow(a, n, 10 ** 7))