#include #define MOD 1000000007 using namespace std; typedef long long ll; typedef pair ii; vector split(string a,char e){ vector rez; string cur; for(int ctr1=0;ctr1>= 1; base = (base*base)%mod; } return result; } int main() { string s; cin>>s; vector r=split(s,'^'); vector no; for(int ctr1=0;ctr1<3;ctr1++) no.push_back(stroi(r[ctr1])); no[0]%=MOD; if(no[0]==0){ cout<<0<<" "<<0; } cout<< ipow(ipow(no[0],no[1],MOD),no[2],MOD) << " " << ipow(no[0], ipow(no[1]%(MOD-1),no[2],MOD-1),MOD) <<"\n"; return 0; }