P26438 [AtCoder] Niconico Numbers
入门
题目描述

Problem Description

A Niconico number is a number that, when expressed in base 10, alternates between the digits 2 and 5, and starts with 2 and ends with 5. For example, $25,\ 2525,\ 252525252525252525$ are Niconico numbers, while $467,\ 5252,\ 5$ are not Niconico numbers.

Niwango-kun wants to find out how many positive integers less than or equal to $ N $ have a Niconico number as a divisor. Please write a program to solve this problem on behalf of Niwango-kun.

Input Format

The input is given from the standard input in the following format:

$ N $

  • The first line contains an integer $N(1\ ≦\ N\ ≦\ 10^9)$.

Output Format

Output the number of positive integers less than or equal to $ N $ that have a Niconico number as a divisor. The output should be on a single line. Do not forget to add a newline at the end of the output.

Sample Input and Output

Sample Input #1

42

Sample Output #1

1

Sample Input #2

20160123

Sample Output #2

806404

Notes/Hints

Sample Explanation 1

Among numbers less than or equal to $ 42 $, only $ 25 $ has a Niconico number as a divisor.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
42
样例输出
1