{"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\u003eIt\u0027s Piegirl\u0027s birthday soon, and Pieguy has decided to buy her a bouquet of flowers and a basket of chocolates.\u003c/p\u003e\u003cp\u003eThe flower shop has \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eF\u003c/i\u003e\u003c/span\u003e different types of flowers available. The \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/span\u003e-th type of flower always has exactly \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ep\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e petals. Pieguy has decided to buy a bouquet consisting of exactly \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eN\u003c/i\u003e\u003c/span\u003e flowers. He may buy the same type of flower multiple times. The \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eN\u003c/i\u003e\u003c/span\u003e flowers are then arranged into a bouquet. The position of the flowers within a bouquet matters. You can think of a bouquet as an ordered list of flower types.\u003c/p\u003e\u003cp\u003eThe chocolate shop sells chocolates in boxes. There are \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eB\u003c/i\u003e\u003c/span\u003e different types of boxes available. The \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/span\u003e-th type of box contains \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ec\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e pieces of chocolate. Pieguy can buy any number of boxes, and can buy the same type of box multiple times. He will then place these boxes into a basket. The position of the boxes within the basket matters. You can think of the basket as an ordered list of box types.\u003c/p\u003e\u003cp\u003ePieguy knows that Piegirl likes to pluck a petal from a flower before eating each piece of chocolate. He would like to ensure that she eats the last piece of chocolate from the last box just after plucking the last petal from the last flower. That is, the total number of petals on all the flowers in the bouquet should equal the total number of pieces of chocolate in all the boxes in the basket.\u003c/p\u003e\u003cp\u003eHow many different bouquet+basket combinations can Pieguy buy? The answer may be very large, so compute it modulo \u003cspan class\u003d\"tex-span\"\u003e1000000007 \u003d 10\u003csup class\u003d\"upper-index\"\u003e9\u003c/sup\u003e + 7\u003c/span\u003e.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line of input will contain integers \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eF\u003c/i\u003e\u003c/span\u003e, \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eB\u003c/i\u003e\u003c/span\u003e, and \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eN\u003c/i\u003e\u003c/span\u003e \u003cspan class\u003d\"tex-span\"\u003e(1 ≤ \u003ci\u003eF\u003c/i\u003e ≤ 10, 1 ≤ \u003ci\u003eB\u003c/i\u003e ≤ 100, 1 ≤ \u003ci\u003eN\u003c/i\u003e ≤ 10\u003csup class\u003d\"upper-index\"\u003e18\u003c/sup\u003e)\u003c/span\u003e, the number of types of flowers, the number of types of boxes, and the number of flowers that must go into the bouquet, respectively.\u003c/p\u003e\u003cp\u003eThe second line of input will contain \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eF\u003c/i\u003e\u003c/span\u003e integers \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ep\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e1\u003c/sub\u003e, \u003ci\u003ep\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e2\u003c/sub\u003e, ..., \u003ci\u003ep\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e\u003ci\u003eF\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e \u003cspan class\u003d\"tex-span\"\u003e(1 ≤ \u003ci\u003ep\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e ≤ 10\u003csup class\u003d\"upper-index\"\u003e9\u003c/sup\u003e)\u003c/span\u003e, the numbers of petals on each of the flower types.\u003c/p\u003e\u003cp\u003eThe third line of input will contain \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eB\u003c/i\u003e\u003c/span\u003e integers \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ec\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e1\u003c/sub\u003e, \u003ci\u003ec\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e2\u003c/sub\u003e, ..., \u003ci\u003ec\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e\u003ci\u003eB\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e \u003cspan class\u003d\"tex-span\"\u003e(1 ≤ \u003ci\u003ec\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e ≤ 250)\u003c/span\u003e, the number of pieces of chocolate in each of the box types.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint the number of bouquet+basket combinations Pieguy can buy, modulo \u003cspan class\u003d\"tex-span\"\u003e1000000007 \u003d 10\u003csup class\u003d\"upper-index\"\u003e9\u003c/sup\u003e + 7\u003c/span\u003e.\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\u003e2 3 3\n3 5\n10 3 7\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e17\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\u003e6 5 10\n9 3 3 4 9 9\n9 9 1 6 4\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e31415926\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 is \u003cspan class\u003d\"tex-span\"\u003e1\u003c/span\u003e way to make a bouquet with \u003cspan class\u003d\"tex-span\"\u003e9\u003c/span\u003e petals \u003cspan class\u003d\"tex-span\"\u003e(3 + 3 + 3)\u003c/span\u003e, and \u003cspan class\u003d\"tex-span\"\u003e1\u003c/span\u003e way to make a basket with \u003cspan class\u003d\"tex-span\"\u003e9\u003c/span\u003e pieces of chocolate \u003cspan class\u003d\"tex-span\"\u003e(3 + 3 + 3)\u003c/span\u003e, for \u003cspan class\u003d\"tex-span\"\u003e1\u003c/span\u003e possible combination. There are \u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e ways to make a bouquet with \u003cspan class\u003d\"tex-span\"\u003e13\u003c/span\u003e petals \u003cspan class\u003d\"tex-span\"\u003e(3 + 5 + 5, 5 + 3 + 5, 5 + 5 + 3)\u003c/span\u003e, and \u003cspan class\u003d\"tex-span\"\u003e5\u003c/span\u003e ways to make a basket with \u003cspan class\u003d\"tex-span\"\u003e13\u003c/span\u003e pieces of chocolate \u003cspan class\u003d\"tex-span\"\u003e(3 + 10, 10 + 3, 3 + 3 + 7, 3 + 7 + 3, 7 + 3 + 3)\u003c/span\u003e, for \u003cspan class\u003d\"tex-span\"\u003e15\u003c/span\u003e more combinations. Finally there is \u003cspan class\u003d\"tex-span\"\u003e1\u003c/span\u003e way to make a bouquet with \u003cspan class\u003d\"tex-span\"\u003e15\u003c/span\u003e petals \u003cspan class\u003d\"tex-span\"\u003e(5 + 5 + 5)\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e1\u003c/span\u003e way to make a basket with \u003cspan class\u003d\"tex-span\"\u003e15\u003c/span\u003e pieces of chocolate \u003cspan class\u003d\"tex-span\"\u003e(3 + 3 + 3 + 3 + 3)\u003c/span\u003e, for \u003cspan class\u003d\"tex-span\"\u003e1\u003c/span\u003e more combination.\u003c/p\u003e\u003cp\u003eNote that it is possible for multiple types of flowers to have the same number of petals. Such types are still considered different. Similarly different types of boxes may contain the same number of pieces of chocolate, but are still considered different.\u003c/p\u003e"}}]}