Description
Define S(n) as the sum of the k-th powers of the digits of n.
Define H(n) as the maximum value satisfying H(n)≤min{n,H(S(n))}.
Compute ∑i=ABH(i)mod(107+7).
One line with three integers k,A,B.
One integer, equal to ∑i=ABH(i)mod(107+7).
2 1 5
14
Hint
For 20% of the testdata, A,B≤50.
For 100% of the testdata, 1≤A,B≤106, 1≤k≤6.
Translated by ChatGPT 5