P=1e9+6,x;long a,b,c;p(a,i,m){x=i?p(1L*a*a%m,i/2,m)*1L*(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/2,P),~P));}