Card Divisibility
면접 대비시간 제한1초메모리 제한1024 MB
L부터 R까지의 정수를 이어 붙여 만든 수를 9로 나눈 나머지를 구한다.
문제
Since you have learned Modular Arithmetic, you know how to work with quotients and remainders. For every pair of integers and with , there exist unique integers and such that and . 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 to . 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 in ) when this number is divided by . For example, and means you are holding cards . Concatenating these numbers produces the number . The remainder left upon dividing this number by would be .
입력
Input consists of a single line containing two integers () and (). This means you are holding the cards with numbers from to , inclusive.
출력
Display a single line containing the remainder of the concatenated number if you were to divide it by .