The first line of each test case will contain four positive integers n, m, s, and e, where n (2 ≤ n ≤ 100) is the number of traffic lights (numbered 0 through n-1), m is the number of roads between the traffic lights, and s and e (s = e) are the starting and ending lights for the desired trip. There will then follow n lines of the form g y r indicating the number of seconds that each light is green, then yellow, then red. (1 ≤ g, y, r ≤ 100.) The first of these lines refers to light 0, the second to light 1, and so on. Following these n lines will be m lines, each describing one road. These lines will have the form l1 l2 t, where l1 and l2 are the two lights being connected by the road and t is the time (in seconds, t ≤ 500) to travel the length of the road at full speed — you should add 5 to this value to obtain the travel time when driving the road beginning at a standstill. All roads are two way. At time 0, all lights are just starting their green period and your car is con- sidered to be at a standstill at traffic light s. Since it takes 5 seconds to get going, you may assume that g + y is never less than or equal to 5. The last test case is followed by a line containing 0 0 0 0 indicating end-of-input.