The number + its inverted number <= S

Revision ru1, by Sergio86, 2024-12-26 00:01:00

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?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
ru1 Russian Sergio86 2024-12-26 00:01:00 582 Первая редакция (опубликовано)