Problem

Code:

```
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
int power(long long a, int b)
{
long long res = 1;
if (!b) return res;
a %= mod;
if (!a) return 0;
while (b > 0)
{
if (b & 1) res = ((res*a)%mod);
b >>= 1;
a = ((a*a)%mod);
}
return res;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n;
cin >> n;
while (n--)
{
long long a, b, c;
cin >> a >> b >> c;
cout << power(a, power(b, c)) << '\n';
}
}
```

We have to find a^{b^c} \pmod{10^9+7}, \ 0 \leq a, \ b, \ c \leq 10^9 which I do in O(\log{b} + \log{c}) with modular exponentiation. For some reason, it shows WA.

For example,

case: `3 9 10`

expected: `112070339`

output: `967113723`

Also, assume that 0^0 = 1.

I donâ€™t know what Iâ€™ve done wrong because it passes most cases.

Please help me.