hackerrank.com currently organizing above mentioned contest…in this contest there are complex modulo related problems …maximum problem gives TLE…can any one tell how to solve these (modulo related) problems within time limit…or can suggest any book which can help me…or any other resource…

thanks…

for example…

Tn = (n^K) x (R^n)

You have to find the Sum of the series Sn = T1 + T2 + T3 + …. + Tn

Find Sn % (10^9 + 7)

where

1 <= K <= 10^3

1 <= n <= 10^16

2 <= R <= 10^16