P=1e9+6,x;long a,b,c;p(long a,long i,int m){x=i?p(a*a%m,i/2,m)*(i%2?a:1)%m:!!a;}main(){scanf("%ld^%ld^%ld",&a,&b,&c);a=!printf("%ld %ld",p(a,c%P*b,~P),p(a%=~P,p(b%=P,c,P),~P));}