아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Card Divisibility

면접 대비

시간 제한1초메모리 제한1024 MB

요약
L부터 R까지의 정수를 이어 붙여 만든 수를 9로 나눈 나머지를 구한다.
난이도

보통10점 중 4점

유형
수학, 정수론, 구현, 누적 합
정답자
아직 제출이 없습니다

문제

Since you have learned Modular Arithmetic, you know how to work with quotients and remainders. For every pair of integers aa and mm with m>0m>0, there exist unique integers qq and rr such that a=m⋅q+ra=m⋅q+r and 0≤r\<m0≤r\<m. But this is a bit simple, you wonder if you can do something more interesting with this theory.

Right now, you are holding a handful of consecutive cards numbered from LL to RR. You lay the cards out side-by-side to create a single large number (i.e. concatenating the digits of your cards). You would like to know the remainder (which is the rr in a=m⋅q+ra=m⋅q+r) when this number is divided by 99. For example, L=9L=9 and R=11R=11 means you are holding cards 9,10,119,10,11. Concatenating these numbers produces the number 9101191011. The remainder rr left upon dividing this number by 99 would be r=3r=3.

입력

Input consists of a single line containing two integers LL (1≤L≤10121≤L≤10^{12}) and RR (L≤R≤1012L≤R≤10^{12}). This means you are holding the cards with numbers from LL to RR, inclusive.

출력

Display a single line containing the remainder of the concatenated number if you were to divide it by 99.

예제5

  1. 예제 1

    입력
    2 5
    
    예상 출력
    5
    
  2. 예제 2

    입력
    3 10
    
    예상 출력
    7
    
  3. 예제 3

    입력
    3 100
    
    예상 출력
    7
    
  4. 예제 4

    입력
    1000000000 1000000007
    
    예상 출력
    0
    
  5. 예제 5

    입력
    9 11
    
    예상 출력
    3