{"problem":{"name":"Digits Paradise in Hexadecimal","description":{"content":"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 ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc194_f"},"statements":[{"statement_type":"Markdown","content":"In this problem, hexadecimal notations use `0`, ..., `9`, `A`, ..., `F`, representing the values zero through fifteen, respectively.  \nUnless otherwise specified, all notations of numbers are decimal notations.\nHow many integers between $1$ and $N$ (inclusive) have exactly $K$ distinct digits in the hexadecimal notation without leading zeros?  \nPrint this count modulo $(10^9 + 7)$.\n\n## Constraints\n\n*   $1 \\le N \\lt {16}^{2 \\times 10^5}$\n*   $N$ is given in hexadecimal notation without leading `0`s.\n*   $1 \\le K \\le 16$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$ $K$\n\nHere, $N$ is in hexadecimal notation.\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc194_f","tags":[],"sample_group":[["10 1","15\n\nThe hexadecimal number $N$ is $16$ in decimal.  \nIn hexadecimal, the integers between $1$ and $16$ are written as follows:\n\n*   $1$ through $15$: are $1$\\-digit numbers in hexadecimal, containing one distinct digit.\n*   $16$: is $10$ in hexadecimal, containing two distinct digits.\n\nThus, there are $15$ numbers that contain one distinct digit in hexadecimal."],["FF 2","225\n\nAll of the $255$ numbers except the following $30$ numbers contain two distinct digits in hexadecimal: $1, 2, 3, \\dots, \\mathrm{E}, \\mathrm{F}, 11, 22, 33, \\dots, \\mathrm{EE}, \\mathrm{FF}$ in hexadecimal."],["100 2","226"],["1A8FD02 4","3784674"],["DEADBEEFDEADBEEEEEEEEF 16","153954073\n\nPrint the count modulo $(10^9 + 7)$."]],"created_at":"2026-03-03 11:01:14"}}