Beautiful Emails


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C, C++, Java, Python

At AUCPL Inc., HR has pushed for professionalism and kind yet productive language in emails. They have thus installed an advanced AI model that rates the professionalism of each sent email as an integer so that they can be reprimanded or praised. However, in your wisdom, your team is actually using email as a means of machine-to-machine communication, with many emails sending a single integer.

The AI model still rates the professionalism of your single-integer email somehow, and you have derived the model for how it works. An integer is 'beautiful' all of its digits are the same. Here are some examples: 1, 999, 55555, etc. Your overall email professionalism score is the amount of beautiful numbers that divide the integer in your email. Can you calculate the professionalism score for a bunch of your automated emails so HR doesn't put you on an improvement plan?

Input

The input contains a single integer n (1 \leq n \leq 10^{18}), the integer sent in your email.

Output

Output a single integer, the professionalism score of your email. I.e. the amount of beautiful numbers (numbers whose digits are all the same) divide n. Do not count 0 as a beautiful number that divides n.

Example

Input 1
12
Output 1
5

1, 2, 3, 4, and 6 all divide 12 and are beautiful.

Input 2
3996
Output 2
12

1, 2, 3, 4, 6, 9, 111, 222, 333, 444, 666, 999 all divide 3996. Zowie!

Input 3
99999999999
Output 3
6

1, 3, 9, 11111111111, 33333333333, 99999999999 are the only beautiful divisors.


Comments

There are no comments at the moment.