**2 人解决**，4 已尝试。

**3 份提交通过**，共有 9 份提交。

**9.9** EMB 奖励。

**单测试点时限: **3.0 秒

**内存限制: **512 MB

Mr. Panda likes playing with numbers. One day he picked up a number 3612 and found it’s interesting. 3612 can be divided into 3 numbers 3, 6 and 12 which forms an integer geometric sequence.

An integer geometirc sequence is a sequence of at least 3 positive integer numbers , also there is a positive number () that for each (), .

Mr. Panda named this kind of numbers “Happy Number”. He also announced that leading zeros are forbidden, which means there should be no extra zeros before the numbers. Now Mr. Panda would like to know how many Happy Numbers are between and inclusive.

The first line of the input gives the number of test cases (). cases follow. Each test case contains one line which consists of two numbers and ().

For each test case, output one line containing `Case #x: y`

, where `x`

is the test case number (starting from 1) and `y`

is the number of Happy Numbers between and inclusive.

Input

4 123 124 468 470 248 248 124816 124832

Output

Case #1: 1 Case #2: 1 Case #3: 1 Case #4: 1

**2 人解决**，4 已尝试。

**3 份提交通过**，共有 9 份提交。

**9.9** EMB 奖励。

标签