package no403; import java.math.BigInteger; import java.util.Scanner; public class Main { public static BigInteger MOD = BigInteger.valueOf(1000000007); public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] s = sc.next().split("\\^"); BigInteger a = new BigInteger(s[0]); BigInteger b = new BigInteger(s[1]); BigInteger c = new BigInteger(s[2]); BigInteger x = a.modPow(b, MOD).modPow(c, MOD); BigInteger y = a.modPow(b.modPow(c, MOD.subtract(BigInteger.ONE)), MOD); System.out.println(x + " " + y); } }