Sergio86's blog

By Sergio86, history, 25 hours ago, In Russian

For a positive integer x, we define R(x) as a number equal to the inverted x in decimal notation. For example, R(123) = 321, R(1) = 1, and R(100500) = 5001.

For a given number S, calculate the number of integers x such that 1 ≤ x and x+R(x) ≤ S.

As an answer, print the remainder of dividing this number by 10^9 + 7.

Input data In the single line of the input file, INPUT.TXT contains an integer S written without leading zeros (0 < S < 10^100000).

Test: 1000000 Answer: 505449

The idea: the dynamics of the digits of the number?

  • Vote: I like it
  • 0
  • Vote: I do not like it