human
What is a Python program to calculate ab mod 1337 where a is a positive integer and b is an extremely large positive integer given in the form of an array given the following:
I found an interesting problem on https://leetcode.com/problems/super-pow/:
Your task is to calculate ab mod 1337 where a is a positive integer and b is an extremely large positive integer given in the form of an array.

Example1:

a = 2
b = [3]

Result: 8


Example2:

a = 2
b = [1,0]

Result: 1024


Credits:Special thanks to @Stomach_ache for adding this problem and creating all test cases.

I tried it in Python, but could not do it. Can you solve it?
assistant
#Here is Python program to calculate ab mod 1337 where a is a positive integer and b is an extremely large positive integer given in the form of an array.

class Solution:
     def superPow(self, a, b):
         """
         :type a: int
         :type b: List[int]
         :rtype: int
         """
         temp1 = a
         temp = 1
         for i in range(len(b)-1,-1,-1):
             if i<len(b)-1:
                 temp1 = pow(temp1,10) % 1337
             temp2 = pow(temp1,b[i]) % 1337
             temp = temp * temp2 % 1337
         return temp