text: pop(); } stream << "]"; return stream; } template <typename A> ostream &operator<<(ostream &stream, const priority_queue<A> &v) { priority_queue<A> q = v; stream << "["; while (!q.empty()) { stream << q.top() << " "; q.pop(); } stream << "]"; return stream; } template <typename A> ostream &operator<<(ostream &stream, const queue<A> &v) { queue<A> q = v; stream << "["; while (!q.empty()) { stream << q.front() << " "; q.pop(); } stream << "]"; return stream; } template <typename A> ostream &operator<<(ostream &stream, const deque<A> &v) { deque<A> q = v; stream << "["; while (!q.empty()) { stream << q.front() << " "; q.pop_front(); } stream << "]"; return stream; } void run(); int main() { srand(time(NULL)); run(); return 0; } const int mod = 1e9 + 7; const int N = 1003; struct Edge { int a, b; long long cost; Edge(int _a = 0, int _b = 0, long long _cost = 0) : a(_a), b(_b), cost(_cost) {} int to(int from) { return from == a ?b : a; } }; vector<int> g[N]; vector<Edge> e; vector<long long> d(N, LLONG_MAX); vector<int> p(N, -1); vector<bool> u(N * 100, false); long long dejkstra(int s, int t, bool f = false) { std::fill(d.begin(), d.end(), LLONG_MAX); set<pair<long long, int> > st; d[s] = 0; st.insert({0, s}); while (!st.empty()) { int v = (*st.begin()).second; st.erase(st.begin()); for (int i = 0; i < ((int)g[v].size()); ++i) { auto edg = e[g[v][i]]; if (edg.cost == 0 && f) continue; long long cost = max(1ll, edg.cost); if (d[edg.to(v)] > d[v] + cost) { st.erase({d[edg.to(v)], edg.to(v)}); d[edg.to(v)] = d[v] + cost; p[edg.to(v)] = g[v][i]; st.insert({d[edg.to(v)], edg.to(v)}); } } } 0 ?(cout << "d[t]" << " = " << (d[t]) << "\n") : cout; return d[t]; } void run() { int n, m, L, s, t; scanf("%d%d", &n, &m); scanf("%d%d%d", &L, &s, &t); int a, b, c; for (int i = 0; i < m; ++i) { scanf("%d%d%d", &a, &b, &c); g[a].push_back(((int)e.size())); g[b].push_back(((int)e.size())); e.