시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 512 MB0000.000%

문제

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 5, 77, 363, 4884, 11111, 12121 and 349943 are palindromes.

A range of integers is interesting if it contains an even number of palindromes. The range [L, R], with L ≤ R, is defined as the sequence of integers from L to R (inclusive): (L, L+1, L+2, ..., R-1, R). L and R are the range's first and last numbers.

The range [L1,R1] is a subrange of [L,R] if L ≤ L1 ≤ R1 ≤ R. Your job is to determine how many interesting subranges of [L,R] there are.

입력

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

Limits

  • 1 ≤ T ≤ 120
  • 1 ≤ L ≤ R ≤ 1013

출력

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

예제 입력 1

3
1 2
1 7
12 110

예제 출력 1

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

출처

Contest > Google > Code Jam > Google Code Jam 2009 > Round 3 D1번

채점 및 기타 정보

  • 예제는 채점하지 않는다.