{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"MD","content":"对于一个正整数 $x$,我们定义一种操作对其进行变换。\u003c/p\u003e\n\n每一次操作,将当前 $x$ 的值变为它在二进制表示下 $1$ 的个数。例如:$13_{10}$\u003d$1101_2$,对 $13$ 进行一次操作,会将它变为 $3$,接着对 $3$ 进行一次操作会将其变为 $2$,而对 $2$ 再进行一次操作,会将其变为 $1$。\u003c/p\u003e\n\n很容易发现,对于 $x$ 进行若干次操作后,一定会将其变为 $1$。如上,将 $13$ 变为 $1$ 需要 $3$ 次操作,我们对经过 $k$ 次操作可以变为 $1$ 的数非常感兴趣,称其为\u003cb\u003e特殊数\u003c/b\u003e。\n\n给定 $n$ 和 $k$($n$ 用二进制表示),请求出 $[1,n]$ 中特殊数的个数,答案对 $10^9+7$ 取模。"}},{"title":"Input","value":{"format":"MD","content":"\u003cp\u003e第一行包含一个整数 $n(1\\le n\\le 2^{1000})$。\u003c/p\u003e\n\u003cp\u003e第二行包含一个整数 $k(0\\le k\\le 1000)$。\u003c/p\u003e\n\u003cp\u003e请注意:$n$ 采用二进制表示,且不含前导零。\u003c/p\u003e"}},{"title":"Output","value":{"format":"MD","content":"\u003cp\u003e输出一个整数,为 $[1,n]$ 中特殊数的个数,答案对 $10^9+7$ 取模。\u003c/p\u003e"}},{"title":"Sample 1","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e110\n2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 2","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e111111011\n2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e169\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"MD","content":"\u003cp\u003e第一个样例中,有 $3$ 个特殊数:$3,5,6$。它们经过一次操作均会变为 $2$,再经过一次操作会变为 $1$。\u003c/p\u003e"}}]}