QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 256 MB Points totaux : 100

#15780. Mobile Phone Number

Statistiques

When choosing mobile phone numbers, people often prefer numbers that are easy to remember or considered lucky. For example, they might look for numbers containing several consecutive identical digits or avoid numbers with unlucky homophones. Mobile operators also consider these factors when issuing new numbers, selecting numbers with specific characteristics from a range to sell separately. To facilitate initial planning, operators want to develop a tool to automatically count the number of phone numbers in a range that satisfy certain characteristics.

The tool needs to check for two characteristics: the number must contain at least $3$ consecutive identical digits, and the number must not contain both $8$ and $4$. A phone number must satisfy both characteristics to be considered valid. Examples of valid numbers include: 13000988721, 23333333333, and 14444101000. Examples of invalid numbers include: 1015400080 and 10010012022.

Mobile phone numbers are always $11$ digits long and do not contain a leading $0$. The tool receives two numbers $L$ and $R$ and automatically counts the number of valid phone numbers in the interval $[L, R]$. $L$ and $R$ are also $11$-digit mobile phone numbers.

Input

The input contains a single line with two space-separated positive integers $L$ and $R$.

Output

The output contains a single line with an integer representing the count of valid phone numbers.

Examples

Input 1

12121284000 12121285550

Output 1

5

Note 1

The valid numbers are: 12121285000, 12121285111, 12121285222, 12121285333, 12121285550.

Subtasks

For $30\%$ of the data, $R - L \leq 10^7$;

For $100\%$ of the data, $10^{10} \leq L \leq R < 10^{11}$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.