#include using namespace std; // a^b mod p O(logP) // Tの型は整数型(int64_t推奨) // 使用例: modpow(a, b, mod), modpow(2, b, mod) template T modpow(T a, T b, T p) { T ans = 1; while(b > 0) { if(b & 1) ans = (ans * a) % p; //bの最下位bitが1ならa^(2^i)をかける a = (a * a) % p; b >>= 1; //bを1bit右にシフト } return ans; } int main() { int64_t A, B, C; char f1, f2; cin >> A >> f1 >> B >> f2 >> C; int64_t mod = 1000000007; int64_t ans1 = modpow(A % mod, B, mod); ans1 = modpow(ans1, C, mod); if(A % mod == 0) { cout << ans1 << ' ' << 0 << endl; return 0; } int64_t ans2 = modpow(B % (mod - 1), C, mod - 1); ans2 = modpow(A % mod, ans2, mod); cout << ans1 << ' ' << ans2 << endl; return 0; }