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