from heapq import heapify, heappop, heappush from collections import deque def main(): N,S,T,K = map(int,input().split()); INF = float("inf") S-=1;T-=1 #0-index X = list(map(int,input().split())) G = [[] for _ in range(N)] M = int(input()) for _ in range(M): A,B,Y = map(int,input().split()) A-=1;B-=1 G[A].append((Y,B)) Q = deque([]) Q.append(S) d_bfs = [INF]*N d_bfs[S] = 1 while Q: v = Q.popleft() for cost, u in G[v]: if d_bfs[u] != INF: continue d_bfs[u] = d_bfs[v] + 1 Q.append(u) if d_bfs[T] == INF: print("Impossible");exit() def dijkstra_heap2(s,G,t,K): INF = float("inf") #S:start, V: node, E: Edge, G: Graph V = len(G) #dp[i][j]: i番目の歌を歌って今j曲目(i番目の歌を含む) if K <= 10: MAX = 20 elif K <= 130: MAX = 1000 else: MAX = pow(10,5) dp = [[INF]*MAX for _ in range(V)] #d = [INF for _ in range(V)] dp[s][1] = X[s] prev = [[-1]*MAX for _ in range(V)] PQ = [] heappush(PQ,(X[s],s,1)) #時間, 位置, 何曲目 while PQ: c,v,n = heappop(PQ) if v == t and n >= K: break if dp[v][n] < c: continue dp[v][n] = c if n+1 >= MAX: #これ以上は配列外参照 continue for cost,u in G[v]: if dp[u][n+1] <= cost + X[u] + dp[v][n]: continue dp[u][n+1] = cost + X[u] + dp[v][n] prev[u][n+1] = v heappush(PQ,(dp[u][n+1], u, n+1)) return dp, prev d, keiro = dijkstra_heap2(S,G,T,K) #print(d) #print(keiro) ans = INF num = INF #何曲か for i in range(K,len(d[T])): if d[T][i] < ans: ans = d[T][i] num = i if ans == INF: print("Impossible") else: print("Possible") print(ans) print(num) ret = [T+1] #1-index #num -= 1 now = T while num > 1: pre = keiro[now][num] ret.append(pre+1) #1-index now = pre num -= 1 ret.reverse() print(*ret) if __name__ == '__main__': main()