```
int superPow(int a, vector<int>& b) {
int preBase = a%1337;
int n = b.size();
int prev = 1;
for(int i = n-1; i >= 0; --i) {
int cur = 1;
for(int k=0; k<b[i]; ++k) {
cur = (cur*preBase) % 1337;
}
prev = (cur*prev) % 1337;
for(int k=b[i]; k<10; ++k) {
cur = (cur * preBase) % 1337;
}
preBase = cur;
}
return prev;
}
```