
def main():

    num1 = int(raw_input())
    num2 = int(raw_input())
    num3 = int(raw_input())

    print(pow(num1,num2))
    print(pow(num1,num2,num3))

    return None

if __name__ == '__main__':
    main()
