#include #include #include #include #include #include #include using namespace std; typedef long long ll; const int mod = 1000000007; ll modpow(ll x, ll n, ll mod) { x %= mod; if(n == 0) return 1; ll res = modpow(x * x % mod, n / 2, mod); if(n & 1) res = res * x % mod; return res; } int main() { cin.tie(0); ios::sync_with_stdio(false); ll A, B, C; char c; cin >> A >> c >> B >> c >> C; if(A % mod == 0) { cout << "0 0" << endl; return 0; } ll ans1 = modpow(modpow(A, B, mod), C, mod); ll ans2 = modpow(A, modpow(B, C, mod - 1), mod); cout << ans1 << " " << ans2 << endl; }