package no403; import java.util.Scanner; public class Main { public static long MOD = 1000000007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] s = sc.next().split("\\^"); long a = Long.parseLong(s[0]); long b = Long.parseLong(s[1]); long c = Long.parseLong(s[2]); long x = pow(pow(a,b,MOD),c,MOD); long y = pow(a,pow(b,c,MOD-1),MOD); System.out.println(x + " " + y); } public static long pow(long a,long n,long mod) { long res = 1; while(n > 0) { if ((n & 1) > 0) { res = (res * a) % mod; } a = (a * a) % mod; n/=2; } return res; } }