import heapq N,M,S,G = map(int,input().split()) F = {i:[] for i in range(N)} for _ in range(M): a,b,c = map(int,input().split()) F[a].append((b,c)) F[b].append((a,c)) INFTY = 10**7 dist = [INFTY]*N visited = [False]*N Pa = [-1]*N def restore(u): seq = [u] x = u while x!=S: y = Pa[x] seq.append(y) x = y seq = seq[::-1] return seq dist[S] = 0 heap = [(0,S)] while heap: d,u = heapq.heappop(heap) if dist[u]d+c: dist[v] = d+c Pa[v] = u heapq.heappush(heap,(d+c,v)) elif dist[v]==d+c: u1 = Pa[v] seq1 = restore(u1) seq1.append(v) seq = restore(u) seq.append(v) if seq