{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv\u003e\u003cp\u003eFarmer John has decided to reward his cows for their hard work by taking them on a tour of the big city! The cows must decide how best to spend their free time.\u003c/p\u003e\u003cp\u003eFortunately, they have a detailed city map showing the \u003ci\u003eL\u003c/i\u003e (2 ≤ \u003ci\u003eL\u003c/i\u003e ≤ 1000) major landmarks (conveniently numbered 1.. \u003ci\u003eL\u003c/i\u003e) and the \u003ci\u003eP\u003c/i\u003e (2 ≤ \u003ci\u003eP\u003c/i\u003e ≤ 5000) unidirectional cow paths that join them. Farmer John will drive the cows to a starting landmark of their choice, from which they will walk along the cow paths to a series of other landmarks, ending back at their starting landmark where Farmer John will pick them up and take them back to the farm. Because space in the city is at a premium, the cow paths are very narrow and so travel along each cow path is only allowed in one fixed direction.\u003c/p\u003e\u003cp\u003eWhile the cows may spend as much time as they like in the city, they do tend to get bored easily. Visiting each new landmark is fun, but walking between them takes time. The cows know the exact fun values \u003ci\u003eF\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e (1 ≤ \u003ci\u003eF\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e ≤ 1000) for each landmark \u003ci\u003ei\u003c/i\u003e.\u003c/p\u003e\u003cp\u003eThe cows also know about the cowpaths. Cowpath \u003ci\u003ei\u003c/i\u003e connects landmark \u003ci\u003eL\u003c/i\u003e\u003csub\u003e1\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e to \u003ci\u003eL\u003c/i\u003e\u003csub\u003e2\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e (in the direction \u003ci\u003eL\u003c/i\u003e\u003csub\u003e1\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e -\u0026gt; \u003ci\u003eL\u003c/i\u003e\u003csub\u003e2\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e ) and requires time \u003ci\u003eT\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e (1 ≤ \u003ci\u003eT\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e ≤ 1000) to traverse.\u003c/p\u003e\u003cp\u003eIn order to have the best possible day off, the cows want to maximize the average fun value per unit time of their trip. Of course, the landmarks are only fun the first time they are visited; the cows may pass through the landmark more than once, but they do not perceive its fun value again. Furthermore, Farmer John is making the cows visit at least two landmarks, so that they get some exercise during their day off.\u003c/p\u003e\u003cp\u003eHelp the cows find the maximum fun value per unit time that they can achieve.\u003c/p\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e* Line 1: Two space-separated integers: \u003ci\u003eL\u003c/i\u003e and \u003ci\u003eP\u003c/i\u003e\u003cbr\u003e* Lines 2..\u003ci\u003eL\u003c/i\u003e+1: Line \u003ci\u003ei\u003c/i\u003e+1 contains a single one integer: \u003ci\u003eF\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e\u003cbr\u003e* Lines \u003ci\u003eL\u003c/i\u003e+2..\u003ci\u003eL\u003c/i\u003e+\u003ci\u003eP\u003c/i\u003e+1: Line \u003ci\u003eL\u003c/i\u003e+\u003ci\u003ei\u003c/i\u003e+1 describes cow path \u003ci\u003ei\u003c/i\u003e with three space-separated integers: \u003ci\u003eL\u003c/i\u003e\u003csub\u003e1\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e , \u003ci\u003eL\u003c/i\u003e\u003csub\u003e2\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e , and \u003ci\u003eT\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e \u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e* Line 1: A single number given to two decimal places (do not perform explicit rounding), the maximum possible average fun per unit time, or 0 if the cows cannot plan any trip at all in accordance with the above rules.\u003c/p\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\u003e5 7\r\n30\r\n10\r\n10\r\n5\r\n10\r\n1 2 3\r\n2 3 2\r\n3 4 5\r\n3 5 2\r\n4 5 5\r\n5 1 3\r\n5 2 2\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e6.00\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}