#ABC235F. [ABC235F] Variety of Digits
[ABC235F] Variety of Digits
Score : points
Problem Statement
Given are digits .
Find the sum, modulo , of all integers between and (inclusive) that contain all of when written in base without unnecessary leading zeros.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Between and , there are six integers that contain both 0
and 1
when written in base : .
The sum of them is .
Between and , no integer contains all of 1
, 2
, 3
, 4
.
Be sure to find the sum modulo .