#include using namespace std; struct iofast_t { iofast_t() { ios::sync_with_stdio(false); cin.tie(nullptr); } } iofast; struct uns_t {} uns; template auto vec(Element init, Head arg, Args ...args) { if constexpr (sizeof...(Args) == 0) return std::vector(arg, init); else return std::vector(arg, vec(init, args...)); } template auto vec(uns_t, Head arg, Args ...args) { return vec(Element(), arg, args...); } template > T &chmin(T &l, T r, Compare &&f = less()) { return l = min(l, r, f); } template > T &chmax(T &l, T r, Compare &&f = less()) { return l = max(l, r, f); } template using pqueue = priority_queue, greater>; int main() { constexpr int64_t inf = INT64_MAX / 4; constexpr auto inv = make_tuple(-1, -1); int n, s, t, k; cin >> n >> s >> t >> k; --s; --t; auto x = vec(uns, n); for (auto &e : x) cin >> e; int m; cin >> m; auto g = vec>(uns, n, 0); for (int i = 0; i < m; ++i) { int a, b, y; cin >> a >> b >> y; --a; --b; g[a].push_back({ b, x[b] + y }); } pqueue> que; auto dist = vec(inf, n, k + 1); auto prev = vec>(inv, n, k + 1); que.push({ x[s], s, 1 }); dist[s][1] = x[s]; while (!empty(que)) { auto [d, v, c] = que.top(); que.pop(); if (dist[v][c] < d) { continue; } for (auto [u, w] : g[v]) { if (dist[u][min(k, c + 1)] <= d + w) { continue; } dist[u][min(k, c + 1)] = d + w; prev[u][min(k, c + 1)] = { v, c }; que.push({ dist[u][min(k, c + 1)], u, min(k, c + 1) }); } } if (dist[t][k] == inf) { cout << "Impossible" << endl; return 0; } auto path = [&] { auto path = vec(uns, 0); int v = t, c = k; while (0 <= v && 0 <= c) { path.push_back(v); auto [pv, pc] = prev[v][c]; v = pv; c = pc; } reverse(begin(path), end(path)); return path; }(); cout << "Possible" << endl; cout << dist[t][k] << endl; cout << size(path) << endl; cout << path[0] + 1; for (int i = 1; i < size(path); ++i) { cout << ' ' << path[i] + 1; } cout << endl; }