{"trustable":true,"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\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\u003cspan class\u003d\"tex-font-style-it\"\u003eThis problem is same as the previous one, but has larger constraints\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eAki is playing a new video game. In the video game, he will control Neko, the giant cat, to fly between planets in the Catniverse.\u003c/p\u003e\u003cp\u003eThere are $$$n$$$ planets in the Catniverse, numbered from $$$1$$$ to $$$n$$$. At the beginning of the game, Aki chooses the planet where Neko is initially located. Then Aki performs $$$k - 1$$$ moves, where in each move Neko is moved from the current planet $$$x$$$ to some other planet $$$y$$$ such that:\u003c/p\u003e\u003cul\u003e \u003cli\u003e Planet $$$y$$$ is not visited yet. \u003c/li\u003e\u003cli\u003e $$$1 \\leq y \\leq x + m$$$ (where $$$m$$$ is a fixed constant given in the input) \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThis way, Neko will visit exactly $$$k$$$ different planets. Two ways of visiting planets are called different if there is some index $$$i$$$ such that, the $$$i$$$-th planet visited in the first way is different from the $$$i$$$-th planet visited in the second way.\u003c/p\u003e\u003cp\u003eWhat is the total number of ways to visit $$$k$$$ planets this way? Since the answer can be quite large, print it modulo $$$10^9 + 7$$$.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe only line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \\le n \\le 10^9$$$, $$$1 \\le k \\le \\min(n, 12)$$$, $$$1 \\le m \\le 4$$$)\u0026nbsp;— the number of planets in the Catniverse, the number of planets Neko needs to visit and the said constant $$$m$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint exactly one integer\u0026nbsp;— the number of different ways Neko can visit exactly $$$k$$$ planets. Since the answer can be quite large, print it modulo $$$10^9 + 7$$$.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","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\u003e3 3 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","value":{"format":"HTML","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\u003e4 2 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e9\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","value":{"format":"HTML","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\u003e5 5 4\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e120\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","value":{"format":"HTML","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\u003e100 1 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e100\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eIn the first example, there are $$$4$$$ ways Neko can visit all the planets:\u003c/p\u003e\u003cul\u003e \u003cli\u003e $$$1 \\rightarrow 2 \\rightarrow 3$$$ \u003c/li\u003e\u003cli\u003e $$$2 \\rightarrow 3 \\rightarrow 1$$$ \u003c/li\u003e\u003cli\u003e $$$3 \\rightarrow 1 \\rightarrow 2$$$ \u003c/li\u003e\u003cli\u003e $$$3 \\rightarrow 2 \\rightarrow 1$$$ \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eIn the second example, there are $$$9$$$ ways Neko can visit exactly $$$2$$$ planets:\u003c/p\u003e\u003cul\u003e \u003cli\u003e $$$1 \\rightarrow 2$$$ \u003c/li\u003e\u003cli\u003e $$$2 \\rightarrow 1$$$ \u003c/li\u003e\u003cli\u003e $$$2 \\rightarrow 3$$$ \u003c/li\u003e\u003cli\u003e $$$3 \\rightarrow 1$$$ \u003c/li\u003e\u003cli\u003e $$$3 \\rightarrow 2$$$ \u003c/li\u003e\u003cli\u003e $$$3 \\rightarrow 4$$$ \u003c/li\u003e\u003cli\u003e $$$4 \\rightarrow 1$$$ \u003c/li\u003e\u003cli\u003e $$$4 \\rightarrow 2$$$ \u003c/li\u003e\u003cli\u003e $$$4 \\rightarrow 3$$$ \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eIn the third example, with $$$m \u003d 4$$$, Neko can visit all the planets in any order, so there are $$$5! \u003d 120$$$ ways Neko can visit all the planets.\u003c/p\u003e\u003cp\u003eIn the fourth example, Neko only visit exactly $$$1$$$ planet (which is also the planet he initially located), and there are $$$100$$$ ways to choose the starting planet for Neko.\u003c/p\u003e"}}]}