Fax McClad, Croneria's most curious bounty hunter, is interested certain numbers.

A number is called a **palindrome** if it is the same when read left-to-right or right-to-left. For example, is a palindrome, and is not. Leading zeroes are not part of a palindrome. For example, is not a palindrome.

Fax also loves the number and any multiple of it.

Fax is interested in the palindromes that are divisible by between and , inclusive. He will do this times. Can you tell him how many of these numbers there are?

#### Input Specification

The first line of input will contain and .

The lines of input follow. Each line will contain and .

For of the points, .

For an additional of the points, , .

#### Output Specification

On separate lines, print the answer to each query.

#### Sample Input

```
2 2
10 50
100 300
```

#### Sample Output

```
2
10
```

#### Explanation for Sample Output

For the first query, are the only palindromes in between and . Only and are divisible by .

## Comments

Would Anyone be so kind and give me some tips on my code?

https://dmoj.ca/submission/2609021

Im struggling on passing batch 4 test case 13.

Thanks!

You are looping through every element in

`array`

and breaking when an element is larger than`M`

(the upper bound). Since`array`

is sorted in your code, think of a searching technique that is more efficient than a linear scan.