{"trustable":true,"prependHtml":"\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\r\nCalculating the derivative of a polynomial is an easy task. \r\nBut what about calculating the derivative of \u003cimg src\u003d\"CDN_BASE_URL/1c61539e5fffbecf305d758857c1e439?v\u003d1716121777\"\u003e, where \u003cimg src\u003d\"CDN_BASE_URL/09399631e8df22ee8f1ffc363600c6c6?v\u003d1716121777\"\u003e is vector? \r\nHere we denote \u003cimg src\u003d\"CDN_BASE_URL/f4a256c2d474c970d8ba767c247d8087?v\u003d1716121777\"\u003e.\r\nTo calculate the derivative of \u003cimg src\u003d\"CDN_BASE_URL/1c61539e5fffbecf305d758857c1e439?v\u003d1716121777\"\u003e, you should know 5 rules: \r\n\u003c/p\u003e\u003col\u003e\r\n\u003cli\u003e\u003cimg src\u003d\"CDN_BASE_URL/809bbdaeb90f62933f37674ded3cb867?v\u003d1716121777\"\u003e, where \u003cimg src\u003d\"CDN_BASE_URL/09399631e8df22ee8f1ffc363600c6c6?v\u003d1716121777\"\u003e is a vector here.\u003c/li\u003e\r\n\u003cli\u003e\u003cimg src\u003d\"CDN_BASE_URL/34a39f9808119100f4865da28948f89b?v\u003d1716121777\"\u003e, where \u003cimg src\u003d\"CDN_BASE_URL/da5e1a505e871c3dbe1b0569395c2671?v\u003d1716121777\"\u003e and \u003cimg src\u003d\"CDN_BASE_URL/e78594c09dd3fb51e098468fed45d928?v\u003d1716121777\"\u003e means to take \u003cimg src\u003d\"CDN_BASE_URL/9255ba13517b1c30213a9b3d1d9c1b2f?v\u003d1716121777\"\u003e as constants for \u003cimg src\u003d\"CDN_BASE_URL/1c61539e5fffbecf305d758857c1e439?v\u003d1716121777\"\u003e.\u003c/li\u003e\r\n\u003cli\u003e\u003cimg src\u003d\"CDN_BASE_URL/de2bd1656a894e93c94ead3139be867f?v\u003d1716121777\"\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cimg src\u003d\"CDN_BASE_URL/e6ac0c333129eb9a94639819e4dc9c7c?v\u003d1716121777\"\u003e, where \u003cimg src\u003d\"CDN_BASE_URL/f386b6cc3469d35bbb5398849f0209a0?v\u003d1716121777\"\u003e is a constant.\u003c/li\u003e\r\n\u003cli\u003e\u003cimg src\u003d\"CDN_BASE_URL/83d2e91c45f388409e942b1953432219?v\u003d1716121777\"\u003e, where \u003cimg src\u003d\"CDN_BASE_URL/9dc76cba6d7248ea8439ea83542ac3e0?v\u003d1716121777\"\u003e and \u003cimg src\u003d\"CDN_BASE_URL/f386b6cc3469d35bbb5398849f0209a0?v\u003d1716121777\"\u003e is a constant.\u003c/li\u003e\r\n\u003c/ol\u003e\r\n\u003cp\u003e\u003c/p\u003e\r\n\u003cp\u003e\r\nNow your task is to calculate the first-derivative of \u003cimg src\u003d\"CDN_BASE_URL/0d04471108d489d044ddf28639bdc844?v\u003d1716121777\"\u003e for some given \u003cimg src\u003d\"CDN_BASE_URL/09399631e8df22ee8f1ffc363600c6c6?v\u003d1716121777\"\u003e.\r\n\u003c/p\u003e\r\n\u003cp\u003e\u003cb\u003eInput\u003c/b\u003e\u003c/p\u003e\r\n\u003cp\u003e\r\nThe first line of the input contains an integer \u003ci\u003eT\u003c/i\u003e (\u003ci\u003eT\u003c/i\u003e \u0026lt;\u003d 10), indicating the number of cases. \r\n\u003c/p\u003e\r\nEach test case contains two blocks.\u003cbr\u003e\r\nThe first line of the first block contains two integers, \u003ci\u003en\u003c/i\u003e and \u003ci\u003em\u003c/i\u003e (0 \u0026lt; \u003ci\u003en\u003c/i\u003e, \u003ci\u003em\u003c/i\u003e \u0026lt;\u003d 100), indicating the number of terms of the polynomial and the dimension of \u003cimg src\u003d\"CDN_BASE_URL/09399631e8df22ee8f1ffc363600c6c6?v\u003d1716121777\"\u003e.\r\nThe next \u003ci\u003en\u003c/i\u003e lines contain \u003ci\u003em\u003c/i\u003e + 1 integers each, \u003ci\u003eC\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e, \u003ci\u003ep\u003csub\u003ei1\u003c/sub\u003e\u003c/i\u003e, ..., \u003ci\u003ep\u003csub\u003eim\u003c/sub\u003e\u003c/i\u003e, indicating the coefficient and the exponent of x\u003ci\u003e\u003csub\u003ej\u003c/sub\u003e\u003c/i\u003e of the \u003ci\u003ei\u003c/i\u003e-th term.\u003cbr\u003e\r\nThe first line of the second block contains one integer \u003ci\u003eQ\u003c/i\u003e (0 \u0026lt; \u003ci\u003eQ\u003c/i\u003e \u0026lt;\u003d 100), indicating the number of queries for the given f(x).\r\nEach of the following \u003ci\u003eQ\u003c/i\u003e lines contains \u003ci\u003em\u003c/i\u003e integers each, indicating the entry values of \u003cimg src\u003d\"CDN_BASE_URL/09399631e8df22ee8f1ffc363600c6c6?v\u003d1716121777\"\u003e.\r\n\u003cp\u003e\r\n\u003c/p\u003e\u003cp\u003e\r\n\u003cb\u003eNote\u003c/b\u003e: All the values in the input are nonnegative integers not exceeding 100.\r\n\u003c/p\u003e\r\n\u003cp\u003e\u003c/p\u003e\r\n\u003cp\u003e\u003cb\u003eOutput\u003c/b\u003e\u003c/p\u003e\r\n\u003cp\u003e\r\nFor each query of each test case, output the resulting first-derivative vector in one line, with entries separated by one space and no extra space at the end of the line. \r\nFor the result may be very big, you are only asked to output each element \u003cb\u003emod 1000000007\u003c/b\u003e.\r\n\u003c/p\u003e\r\n\u003cp\u003e\r\nAdd a blank line between two consecutive test cases. There must be no extra blank line at the end of output.\r\n\u003c/p\u003e\r\n\u003cp\u003e\u003cb\u003eSample Input\u003c/b\u003e\u003c/p\u003e\r\n\u003cp\u003e\u003c/p\u003e\u003cpre\u003e\r\n2\r\n3 2\r\n1 2 0\r\n3 0 2\r\n7 0 0\r\n2\r\n1 4\r\n2 3\r\n2 2\r\n1 1 1\r\n9 1 0\r\n2\r\n1 4\r\n2 3\r\n\u003c/pre\u003e\u003cp\u003e\u003c/p\u003e\r\n\u003cp\u003e\u003cb\u003eSample Output\u003c/b\u003e\u003c/p\u003e\r\n\u003cp\u003e\u003c/p\u003e\u003cpre\u003e\r\n2 24\r\n4 18\r\n\r\n13 1\r\n12 2\r\n\u003c/pre\u003e\u003cp\u003e\u003c/p\u003e\r\n\u003cp\u003e\u003cb\u003eHint\u003c/b\u003e\u003c/p\u003e\r\n\u003cp\u003e\r\nThe first-derivative of the first case is \u003cimg src\u003d\"CDN_BASE_URL/b2f3086d7901f67b4a2bb915727874a2?v\u003d1716121777\"\u003e.\u003cbr\u003e\r\nThe first-derivative of the second case is \u003cimg src\u003d\"CDN_BASE_URL/3968c8d8bdc94cb6b9f4ce3425250503?v\u003d1716121777\"\u003e.\r\n\u003c/p\u003e"}}]}