/**
* @param {number} a
* @param {number[]} b
* @return {number}
*/
var superPow = function(a, b) {
if(b == null || b.length === 0) return 1;
function powMod(x, y) {
let res = 1;
for(let i = 0; i < y; i++) {
res = res * x % n;
}
return res;
}
//对1337求余
const n = 1337;
let res = 1;
a %= n;
for(let i = b.length - 1; i >= 0; i--) {
res = powMod(a, b[i]) * res % n;
a = powMod(a, 10);
}
return res;
};