{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cspan lang\u003d\"en-us\"\u003e\u003cp\u003e\u003cimg src\u003d\"CDN_BASE_URL/61bea53b4186f15881294e55f0b02f09?v\u003d1717042970\" align\u003d\"right\" hspace\u003d\"10\"\u003eChristmas is coming to KCM city. Suby the loyal civilian in KCM city is preparing a big neat Christmas tree. The simple structure of the tree is shown in right picture.\u003c/p\u003e\u003cp\u003eThe tree can be represented as a collection of numbered nodes and some edges. The nodes are numbered 1 through \u003ci\u003en\u003c/i\u003e. The root is always numbered 1. Every node in the tree has its weight. The weights can be different from each other. Also the shape of every available edge between two nodes is different, so the unit price of each edge is different. Because of a technical difficulty, price of an edge will be (sum of weights of all descendant nodes) × (unit price of the edge).\u003c/p\u003e\u003cp\u003eSuby wants to minimize the cost of whole tree among all possible choices. Also he wants to use all nodes because he wants a large tree. So he decided to ask you for helping solve this task by find the minimum cost.\u003c/p\u003e\u003c/span\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cspan lang\u003d\"en-us\"\u003e\u003cp\u003eThe input consists of \u003ci\u003eT\u003c/i\u003e test cases. The number of test cases \u003ci\u003eT\u003c/i\u003e is given in the first line of the input file. Each test case consists of several lines. Two numbers \u003ci\u003ev\u003c/i\u003e, \u003ci\u003ee\u003c/i\u003e (0 ≤ \u003ci\u003ev\u003c/i\u003e, \u003ci\u003ee\u003c/i\u003e ≤ 50000) are given in the first line of each test case. On the next line, \u003ci\u003ev\u003c/i\u003e positive integers \u003ci\u003ew\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e indicating the weights of \u003ci\u003ev\u003c/i\u003e nodes are given in one line. On the following \u003ci\u003ee\u003c/i\u003e lines, each line contain three positive integers \u003ci\u003ea\u003c/i\u003e, \u003ci\u003eb\u003c/i\u003e, \u003ci\u003ec\u003c/i\u003e indicating the edge which is able to connect two nodes \u003ci\u003ea\u003c/i\u003e and \u003ci\u003eb\u003c/i\u003e, and unit price \u003ci\u003ec\u003c/i\u003e.\u003c/p\u003e\u003cp\u003eAll numbers in input are less than 2\u003csup\u003e16\u003c/sup\u003e.\u003c/p\u003e\u003c/span\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cspan lang\u003d\"en-us\"\u003e\u003cp\u003eFor each test case, output an integer indicating the minimum possible cost for the tree in one line. If there is no way to build a Christmas tree, print “No Answer” in one line.\u003c/p\u003e\u003c/span\u003e"}},{"title":"Sample","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\r\n2 1\r\n1 1\r\n1 2 15\r\n7 7\r\n200 10 20 30 40 50 60\r\n1 2 1\r\n2 3 3\r\n2 4 2\r\n3 5 4\r\n3 7 2\r\n3 6 3\r\n1 5 9\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e15\r\n1210\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}