John and Brus are first graders. Their first homework assignment is to learn some integer numbers. This is not too difficult for them, and they decide to impress their teacher by learning all lucky numbers between and , inclusive.
As you may know from last year's contest, and are lucky digits, and all other digits are not lucky. A lucky number is a number that consists of only lucky digits in its decimal representation.
After learning all lucky numbers in the range , John and Brus still have some free time. They then decide to additionally learn every lucky number that lies outside the range but whose reversed number is within this range. Here, the reversed number of is the number written in decimal notation with its digits in reverse order. For example, the reversed number of is , and the reversed number of is .
You are given the integers and . Your task is to find the total number of lucky numbers learned by John and Brus.
The first line contains a single integer — the number of test cases. Each test case consists of a single line containing two integers and separated by a single space.
For each test case, print a single line containing the total number of lucky numbers learned by John and Brus.
Constraints
1 \leq T \leq 74
1 \leq A \leq B \leq 10^{47}.
Example 1