ll@(A,B,C),a=0,t=0; rep(x,C)t=(t+powmod(x+1,B,C))%C; rep(x,A%C)a=(a+powmod(x+1,B,C))%C; wt((a+t*(A/C))%C);