The first line contains two numbers: The id-number of the source junction and the id-number of the destination junction.
The second line contains two numbers: N, M.
The following N lines contain information on N junctions. The (i+2)’th line of the input file holds information about the junction i : Ci, ric, tiB, tiP where Ci is either ‘B’ or ‘P’, indicating the initial color of the light at the junction i.
Finally, the next M lines contain information on M roads. Each line is of the form: i, j, lij where i and j are the id-numbers of the junctions which are connected by this road .
2 <= N <=300 where N is the number of junctions. The junctions are identified by integers 1 through N. These numbers are called id-numbers.
1 <=M <=14,000 where M is the number of roads.
1 <= lij <= 100 where lij is the time required to move from junction i to j using the road that connects i and j.
1 <= tic <= 100 where tic is the duration of the color c for the light at the junction i. The index c is either B for blue or P for purple.
1 <= ric <= tic where ric is the remaining time for the initial color c at junction i.
The first line contains two numbers: The id-number of the source junction and the id-number of the destination junction.
The second line contains two numbers: N, M.
The following N lines contain information on N junctions. The (i+2)’th line of the input file holds information about the junction i : Ci, ric, tiB, tiP where Ci is either ‘B’ or ‘P’, indicating the initial color of the light at the junction i.
Finally, the next M lines contain information on M roads. Each line is of the form: i, j, lij where i and j are the id-numbers of the junctions which are connected by this road .