Faulty addition - MarisaOJ: Marisa Online Judge

Faulty addition

Time limit: 1000 ms
Memory limit: 256 MB
Define a "faulty addition" as the process of adding the digits without adhering to the standard rules of carrying. For example: Given an integer $n$, count the number of non-negative integer pairs $a, b$ such that the faulty addition of $a$ and $b$ results in $n$. ### Input - One line containing an integer $n$. ### Output - Print the number of pairs satisfying the condition. Note that pairs $(a, b)$ and $(b, a)$ are considered distinct. ### Constraints - $1 \le n \le 10^{18}$. ### Example Input: ``` 111 ``` Output: ``` 40 ```