There are n places (numbered 1,2,...,n), and at any second X, in place A, it will appear k robots. Now you have normal weapons. If at the second X and you are in place A, you will distroy those k robots. Otherwise, you have a special weapon (named O4), if you at second X in the place A and use O4, you will destroy all the robots which appear in the place adjoining to A (OF COUSE include the place A). You move from place A to B (B adjoins to A) must use some second;
Now you have T second ,and ask you two questions:
1. if you have an O4, how many robots can you destroy?(the maximum number);
2. if you don't have O4 but weapons, how many robots can you destroy?(the maximum number);
First line: n, m, T. (n is the number of place, m is the number of roads between place, T is the seconds you have), n ≤ 100, m ≤ 2500, t ≤ 1000;
From 2 to m + 1 line: every line contains 3 integers, P, Q, D, indicating that moving from place P to place Q will use D seconds (the roads are undirection);
Next every line contains 3 integers, X, A, K, indicating at the X second, the place A will appear K robots;
The last line contains three "0" indicating that the case is end;
The answer to the two question, separate by one space.