Getting NZEC Error while submitting Yalalovichik Numbers solution

While submitting the solution for Yalalovichik Numbers problem,i am getting an NZEC error.I ran the code on IDLE and i am getting the correct output.Here is the code:-https://www.codechef.com/submit/YVNUM

Explanation-

Numbers are stored in the list ‘N’.Each digit of the no. is stored in string ‘a’ in reverse order(For example 123 is stored as “321” in a).After that,except for the last digit in string ‘a’,i.e.,first digit of the number(For the above example,it is 1),the no. stored in string ‘a’ is reversed and stored in ‘sum’(For the above example,“32” is reversed to “23” and stored in ‘sum’ as integer).After that ‘sum’ is converted to string and the last digit of ‘a’ is appended to the ‘sum’.Then ‘sum’ is appended to ‘s’ which is the final output.‘s1’ stores the right shifted version of the no. after each iteration.

Example:-

T=1,
N=123,
After 1st iteration
a=“321”,
sum=“231”,
s=“123231”,
After 2nd iteration
a=“132”,
sum=“312”,
s=“123231312”

Can anyone point out what is the mistake in the above code?