#include "bits/stdc++.h" //#include "atcoder/all" using namespace std; //using namespace atcoder; //using mint = modint1000000007; //const int mod = 1000000007; //using mint = modint998244353; //const int mod = 998244353; //const int INF = 1e9; const long long LINF = 1e18; //const bool debug = false; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i,l,r)for(int i=(l);i<(r);++i) #define rrep(i, n) for (int i = (n-1); i >= 0; --i) #define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i) #define all(x) (x).begin(),(x).end() #define allR(x) (x).rbegin(),(x).rend() #define endl "\n" #define P pair> template inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; } int n, s, t, k; struct Edge { int to, cost; Edge(int _to, int _cost) :to(_to), cost(_cost) {} }; vectorg[200005]; vector> data(3, vector(4)); vectorx; void dikstra() { vector> d(n, vector(k, LINF)); vector>> pre(n, vector>(k, { -1,-1 })); priority_queue, greater

> q;//小さいもの順 q.push({ x[s], { s,0 } }); d[s][0] = x[s]; while (!q.empty()) { auto tmp = q.top(); q.pop(); long long cost = tmp.first; int pos = tmp.second.first; int count = tmp.second.second; if (cost > d[pos][count]) continue; for (Edge e : g[pos]) { long long ncost = cost + e.cost + x[e.to]; int npos = e.to; int ncount = min(k - 1, count + 1); if (ncost < d[npos][ncount]) { pre[npos][ncount] = { pos,count }; d[npos][ncount] = ncost; q.push({ d[npos][ncount], {npos,ncount} }); } } } if (LINF == d[t][k - 1]) { cout << "Impossible" << endl; } else { cout << "Possible" << endl; cout << d[t][k - 1] << endl; vectorans; ans.push_back(t); pairp = pre[t][k - 1]; while (true) { ans.push_back(p.first); p = pre[p.first][p.second]; if (p.first == -1)break; } cout << ans.size() << endl; rrep(i, ans.size()) { cout << ans[i] + 1 << " "; } } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> s >> t >> k; s--; t--; x.resize(n); rep(i, n)cin >> x[i]; int m; cin >> m; rep(i, m) { int a, b, y; cin >> a >> b >> y; a--; b--; g[a].emplace_back(b, y); } dikstra(); return 0; }