# Cese math problem Exponentiation II

#include<bits/stdc++.h>

using namespace std;
const long long MOD = 1e9 + 7;
const long long NN = 1e6;
const double PI = acos(-1.0);
#define IOS ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define ll long long
#define ve vector
#define graph vector
#define fix(res, n) fixed << setprecision(n) << (ld)res
#define tc ll testcase; cin>>testcase; while(testcase–)
#define all(num) (num).begin(), (num).end()

// "وَأَن لَّيْسَ لِلْإِنسَانِ إِلَّا مَا سَعَى ﴿39﴾ وَأَنَّ سَعْيَهُ سَوْفَ يُرَى ﴿40﴾ ثُمَّ يُجْزَاهُ الْجَزَاء الْأَوْفَى "
// My way to My dream
//#ifdef ONLINE_JUDGE
// freopen(“input.txt”, “r”, stdin);
// freopen(“output.txt”, “w”, stdout);
//#endif
//ve dx={1,0,-1,0,1,-1,1,-1};
//ve dy={0,1,0,-1,-1,1,1,-1};
///////////////////////////////////////////////////////////////////////////////////////////////////////
ll mul(ll a,ll b , ll m){
return (a % m * b % m) % m;
}

ll bin_exp(ll a,ll b , ll m) {
ll ans = 1;
while (b) {
if (b & 1) {

``````        ans = mul(ans, a , m);
}

a = mul(a,a, m);
b >>= 1;
}
return ans % MOD;
``````

}
int main() {IOS
tc{
ll a, b , c ; cin >> a >> b >>c;
ll sub=bin_exp(b,c,MOD-1);
cout << bin_exp(a,sub,MOD)<<’\n’;
}
}
that’s is the solution of this problem ans i can’t understand why in the sub exponential the mod subtracted by one

There’s an internal solution.