To store the final answer
Sum = 0 NEW_LINE for i in range ( 1 , k + 1 ) : NEW_LINE INDENT add = count [ i ] % MOD * i % MOD NEW_LINE add = add % MOD NEW_LINE Sum = Sum + add NEW_LINE Sum = Sum % MOD NEW_LINE DEDENT