logo AlgoBeat OnlineJudge
登录 注册

#213572. [GCJ 2009 #3] Interesting Ranges

内存限制:1024 MiB 时间限制:4500 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

A positive integer is a palindrome if its decimal representation (without leading zeros) is a palindromic string (a string that reads the same forwards and backwards). For example, the numbers , , , , , and are palindromes.

A range of integers is interesting if it contains an even number of palindromes. The range , with , is defined as the sequence of integers from to (inclusive): . and are the range's first and last numbers.

The range is a subrange of if . Your job is to determine how many interesting subranges of there are.

输入格式

The first line of input gives the number of test cases, . test cases follow. Each test case is a single line containing two positive integers, and (in that order), separated by a space.

输出格式

For each test case, output one line. That line should contain "Case #x: y", where is the case number starting with , and is the number of interesting subranges of , modulo .

样例

样例输入 1

3
1 2
1 7
12 110

样例输出 1

Case #1: 1
Case #2: 12
Case #3: 2466

数据范围与提示

Limits

Small dataset(9 Pts)

Large dataset(23 Pts)