| 2020-2021 ICPC, Moscow Subregional |
|---|
| Finished |
For any non-negative integer $$$x$$$ we can consider its decimal representation as a string of digits from $$$0$$$ to $$$9$$$. Denote this string as $$$S(x)$$$. On the opposite, for any string $$$s$$$ of decimal digits we can get an integer it represents by neglecting all leading zeroes, except maybe one to represent integer $$$0$$$. Denote this integer $$$D(s)$$$.
We say that integer $$$y$$$ is an integer-substring of integer $$$x$$$ if there exists a string $$$s$$$ that is a substring (consecutive subsequence) of $$$S(x)$$$ and $$$D(s) = y$$$.
Recall that integer $$$x$$$ is called prime if it is positive and has exactly two divisors. First five primes are $$$2, 3, 5, 7, 11$$$.
We call integer $$$x$$$ deep prime if it is prime and any $$$y$$$ that is integer-substring of $$$x$$$ is prime.
You are given two integers $$$n$$$ and $$$m$$$, calculate the number of deep prime integers between $$$n$$$ and $$$m$$$, inclusive.
The only line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq m \leq 10^{18}$$$).
Print one integer — the number of deep prime integers $$$x$$$ that satisfy $$$n \leq x \leq m$$$.
1 11
4
| Name |
|---|


