Given an integer a and an array of digits b representing a very large exponent, compute a^b mod 1337. The exponent is too large for normal integer storage, so the solution must use repeated modular reduction.
a = base, b = exponent digits
a^b mod 1337
Example 1:
Input:
a = 2 b = [3]
Output:
8
Explanation:
2^3 = 8.
Example 2:
Input:
a = 2 b = [1,0]
Output:
1024
Explanation:
2^10 = 1024.