#include
#include
#include
#include
using namespace std;
struct node{
int idx;
int cost;
int distance;
int ostanata;
node(){
}
node(int idx2, int cost2, int distance2, int ostanato2){
idx=idx2;
cost=cost2;
ostanata=ostanato2;
distance=distance2;
}
bool operator < (const node &tmp)const{
return cost > tmp.cost;
}
};
int main()
{
int n, m, x, k, l;
cin>>n>>x>>k>>l>>m;
vector>graph[n+5];
for(int i=0; i>a>>b>>c;
graph[a].push_back(make_pair(b, c));
graph[b].push_back(make_pair(a, c));
}
int distance[n + 5][k + 5][l + 5];
for(int i=0; i<=n; i++){
for(int j=0; j<=k; j++){
for(int z=0; z<=l; z++){
distance[i][j][z]=2e9;
}
}
}
priority_queuep;
p.push(node(1, 0, l, k));
while(!p.empty()){
node c=p.top();
p.pop();
int nova_distanca=c.distance;
if(c.idx<=x and c.distance > 0){
nova_distanca=0;
}
if(nova_distanca>0){
for(int i=0; i=0 and c.cost0){
c.ostanata--;
nova_distanca=l;
for(int i=0; i=0 and c.cost