{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\"Good man never makes girls wait or breaks an appointment!\" said the mandarin duck father. Softly touching his little ducks\u0027 head, he told them a story.\r\u003cbr\u003e\r\u003cbr\u003e\"Prince Remmarguts lives in his kingdom UDF – United Delta of Freedom. One day their neighboring country sent them Princess Uyuw on a diplomatic mission.\"\r\u003cbr\u003e\r\u003cbr\u003e\"Erenow, the princess sent Remmarguts a letter, informing him that she would come to the hall and hold commercial talks with UDF if and only if the prince go and meet her via the K-th shortest path. (in fact, Uyuw does not want to come at all)\"\r\u003cbr\u003e\r\u003cbr\u003eBeing interested in the trade development and such a lovely girl, Prince Remmarguts really became enamored. He needs you - the prime minister\u0027s help!\r\u003cbr\u003e\r\u003cbr\u003eDETAILS: UDF\u0027s capital consists of N stations. The hall is numbered S, while the station numbered T denotes prince\u0027 current place. M muddy directed sideways connect some of the stations. Remmarguts\u0027 path to welcome the princess might include the same station twice or more than twice, even it is the station with number S or T. Different paths with same length will be considered disparate.\r\u003cbr\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line contains two integer numbers N and M (1 \u0026lt;\u003d N \u0026lt;\u003d 1000, 0 \u0026lt;\u003d M \u0026lt;\u003d 100000). Stations are numbered from 1 to N. Each of the following M lines contains three integer numbers A, B and T (1 \u0026lt;\u003d A, B \u0026lt;\u003d N, 1 \u0026lt;\u003d T \u0026lt;\u003d 100). It shows that there is a directed sideway from A-th station to B-th station with time T.\r\u003cbr\u003e\r\u003cbr\u003eThe last line consists of three integer numbers S, T and K (1 \u0026lt;\u003d S, T \u0026lt;\u003d N, 1 \u0026lt;\u003d K \u0026lt;\u003d 1000)."}},{"title":"Output","value":{"format":"HTML","content":"A single line consisting of a single integer number: the length (time required) to welcome Princess Uyuw using the K-th shortest path. If K-th shortest path does not exist, you should output \"-1\" (without quotes) instead."}},{"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 2\r\n1 2 5\r\n2 1 4\r\n1 2 2\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e14\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}