import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Set;

public class Main {
	
	public static final long MOD = 1000000007L;
	
	public static long mod_pow(long a, long p, long MOD){
		if(p == 0){
			return 1;
		}else if(p == 1){
			return a % MOD;
		}else if(p % 2 != 0){
			return (a * mod_pow(a, p - 1, MOD)) % MOD;
		}else{
			final long ret = mod_pow(a, p / 2, MOD);
			
			return (ret * ret) % MOD;
		}
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final String[] inputs = sc.next().split("¥¥^");
		
		final long A = Long.parseLong(inputs[0]);
		final long B = Long.parseLong(inputs[1]);
		final long C = Long.parseLong(inputs[2]);

		final long fst = mod_pow(mod_pow(A, B, MOD), C, MOD);
		final long snd = mod_pow(A, mod_pow(B, C, MOD - 1), MOD);
		System.out.println(fst + " " + snd);
	}

}