Compute power of 10 modulo k
p = [ 0 ] * ( 11 ) NEW_LINE p [ 0 ] = 1 NEW_LINE for i in range ( 1 , 11 ) : NEW_LINE INDENT p [ i ] = ( p [ i - 1 ] * 10 ) % k NEW_LINE DEDENT for i in range ( n ) : NEW_LINE INDENT x = a [ i ] NEW_LINE DEDENT