#abc194f. [abc194_f]Digits Paradise in Hexadecimal
[abc194_f]Digits Paradise in Hexadecimal
Problem Statement
In this problem, hexadecimal notations use 0
, ..., 9
, A
, ..., F
, representing the values zero through fifteen, respectively.
Unless otherwise specified, all notations of numbers are decimal notations.
How many integers between and (inclusive) have exactly distinct digits in the hexadecimal notation without leading zeros?
Print this count modulo .
Constraints
- is given in hexadecimal notation without leading
0
s. - All values in input are integers.
Input
Input is given from Standard Input in the following format:
Here, is in hexadecimal notation.
Output
Print the count modulo .
Sample Input 1
Sample Output 1
The hexadecimal number is in decimal.
In hexadecimal, the integers between and are written as follows:
- through : are -digit numbers in hexadecimal, containing one distinct digit.
- : is in hexadecimal, containing two distinct digits.
Thus, there are numbers that contain one distinct digit in hexadecimal.
Sample Input 2
Sample Output 2
All of the numbers except the following numbers contain two distinct digits in hexadecimal: in hexadecimal.
Sample Input 3
Sample Output 3
Sample Input 4
Sample Output 4
Sample Input 5
Sample Output 5
Print the count modulo .