Multiplying a [ i ] powe times using Fermat Little Theorem under MODulo MOD for fast exponentiation
mul = power ( a [ i ] , powe ) % MOD NEW_LINE ans = ( ( ans % MOD ) * ( mul % MOD ) ) % MOD NEW_LINE return ans % MOD NEW_LINE