//TLights.cc
//ecna 2009
// problem G - Trip the Lights Fantastic
//
// a modification of Dykstra's alg

#include <iostream>
using namespace std;

const int MAX = 1000;

int Used[MAX], Shortest[MAX],  Green[MAX], Red[MAX];
int Grid[MAX][MAX];
int n, E, S;

void GetData(int  m){
  int g, y, r;
  int a, b, t;

  for(int i=0;i<n;i++){
    cin>>g>>y>>r;
    g += y;
    Green[i] = g;
    Red[i] = r;
  }
  //get connections
  //first clear Grid[][]
  for(int i=0;i<n;i++)
   for(int j=0;j<n;j++)
    Grid[i][j]=-1;
  for(int i=0;i<m;i++){
    cin>>a>>b>>t;
    Grid[a][b] = Grid[b][a] = t;
  }
  //clear Used[] and Shortest[]
  for(int i=0;i<n;i++){
    Used[i]=0;
    Shortest[i] = -1;
  }
  //init for starting node
  Used[S]=1;
  Shortest[S]=0;
}

void UpdateShortest(int Node, int Time){
  int ARR, A;

  //run thru all unvisited nodes
  for(int i=0;i<n;i++)
    if(Used[i] ==0 && Grid[Node][i]>0){
      ARR= Time + Grid[Node][i];
      A = ARR % (Green[i] + Red[i]);

      if (A>=Green[i] &&  i != E)
        ARR = (Green[i]+Red[i]) *(ARR / (Green[i]+Red[i]) + 1) + 5;
      //update Shortest[i]?
      if(ARR < Shortest[i] || Shortest[i]==-1)
        Shortest[i] = ARR;
    }
}

int Best(){
  int BestTime = 1000000000, Best =  -1;

  for(int i=0;i<n;i++)
    if(Used[i] == 0)
     if(Shortest[i]>0 && Shortest[i]<BestTime){
       BestTime = Shortest[i];
       Best = i;
     }
  return Best;
}


void PrintTime(int t){
  cout<<t/60<<':';
  t = t%60;
  if(t<10) cout<<'0';
  cout<<t<<endl;
}

// for debugging
void printShortest(){
 cout<<"Shortest: ";
 for(int i=0;i<n;i++)
  cout<<Shortest[i]<<' ';
}

// for debugging
void printData(){
  cout<<"Green[]= ";
  for(int i=0;i<n;i++)
   cout<<Green[i]<<' ';
  cout<<"Red[]= ";
  for(int i=0;i<n;i++)
   cout<<Red[i]<<' ';
  cout<<endl;
}

int main(){
  int m,  Time, Current;

  cin>>n>>m>>S>>E;
  while(n>0){
    GetData(m);   //get distances and init data

    Current = S;
    if (S==E) Time = 0;
    else Time = 5;
    while(Current != E){
      UpdateShortest(Current, Time);
      Current = Best();
      Used[Current] = 1;
      Time = Shortest[Current];
    }
    //Time == quickest from S to E
    PrintTime(Time);

    cin>>n>>m>>S>>E;
  }
  return 0;
}
