typedef long long ll; P=1e9+7; ll a,b,c; ll pom(ll a,ll i,ll m){return i?i%2?pom(a%m*a%m,i/2,m)*a%m:pom(a%m*a%m,i/2,m)%m:1;} main(){ scanf("%lld%*c%lld%*c%lld",&a,&b,&c); a=!printf("%lld %lld",pom(pom(a,b,P),c,P),a%P?pom(a,pom(b,c,P-1),P):0); }