#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996) #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep(i,a,b) for(int i=(a);i<(b);i++) #define pb push_back #define mp(a,b) make_pair(a,b) #define all(a) a.begin(),a.end() #define len(x) ((int)(x).size()) #define tmax(a,b,c) max((a),max((b),(c))) #define debug(x) cerr << #x << " is " << x << endl; typedef pair Pii; typedef vector V; typedef vector > VV; typedef long long ll; const int inf = 2e9; const int mod = 1e9 + 7; const long double eps = 1e-10; ll modpow(ll a, ll b, ll p) { if (a == p) return 0; if (b == 0) return 1; ll ret = modpow(a, b/2, p); if (b%2 == 0) ret = (ret*ret)%p; else ret = (((ret*ret)%p)*a)%p; return ret; } int main() { char x; ll a, b, c; cin >> a >> x >> b >> x >> c; ll d = modpow(a,b,mod); ll e = modpow(d,c,mod); debug(d); cout << e << " "; ll f = modpow(b,c,mod-1); ll g = modpow(a,f,mod); cout << endl; debug(f); cout << g << endl; return 0; }