P13335 [CodeChef] sdsquare
普及
题目描述

Recently Chef become very much interested in perfect squares. We all know Chef and his weird interests. Anyways Chef will be soon writing his masters thesis on perfect squares revealing what-not-known properties of perfect squares.
While doing his research, he happened to be confronted with some interesting perfect squares. These prefect squares consists only of digits which are themselves perfect squares. 0, 1, 4 and 9 are such digits. These are called perfect digits.
As we all know Chef also has habit of asking too many questions, he is asking- given two numbers a and b, how many perfect squares exists between these two numbers inclusive, that contains only perfect digits. 
Input:
First line of input will contains T, number of test cases. Then T lines follows, each containing two positive integers a and b.
Constraints:
T <= 500
1<= a <= b <= 10000000000 
Output:
For each input, output number of perfect digit squares between given numbers. 
Sample
Input:
2
1 10
100 10000
Output:
3
9

输入格式

见题面

输出格式

见题面

样例输入
2 1 10 100 10000
样例输出
3 9