#P1940. Reversible Number

Reversible Number

Description

Some positive integers nn satisfy that in n+rev(n)n + \text{rev}(n) (where rev(n)\text{rev}(n) is the number obtained by reversing the decimal digits of nn), every digit of the sum is odd.

For example:

  • When n=36n = 36, 36+63=9936 + 63 = 99.
  • When n=409n = 409, 409+904=1313409 + 904 = 1313.

We call such nn Reversible numbers. Therefore, 3636, 6363, 409409, and 904904 are all Reversible numbers.

Numbers with leading zeros are not considered Reversible numbers.

How many Reversible numbers are there that are less than or equal to 10x10^x?

Input Format

A single positive integer xx.

Output Format

Output a single line containing one integer, the answer.

4

720

Hint

For 30%30\% of the testdata, the answer does not exceed 23212^{32} - 1.

For 100%100\% of the testdata, 3x4003 \le x \le 400.

Translated by ChatGPT 5