number, count = map(int, input().split())
choise = 10**7

print(choise)
print(pow(number,count,choise))