- Prepare
- Mathematics
- Number Theory
- Megaprime Numbers

# Megaprime Numbers

# Megaprime Numbers

A prime number is an integer greater than that has no positive divisors other than and itself.

We call a number *megaprime* if it is prime and all of its individual digits are prime. For example, is megaprime because it is prime and all its digits ( and ) are prime; however, is not megaprime because it is not prime (it's divisible by and ), and is not megaprime because it has a non-prime digit ( is not prime).

Given two long integers, and , find and print the total number of megaprime numbers in the inclusive range between and .

**Input Format**

Two space-separated long integers describing the respective values of and .

**Constraints**

**Output Format**

Print a long integer denoting the total number of megaprimes in the inclusive interval between and .

**Sample Input 0**

```
1 100
```

**Sample Output 0**

```
8
```

**Explanation 0**

There are eight megaprime numbers in the inclusive range from to (i.e., , , , , , , , and ), so we print as our answer.