#include <functional>
#include <algorithm>
#include <iostream>
#include <utility>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cstring>
#include <vector>
#include <cstdio>
#include <string>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <map>
#include <set>
//#define pb push_back
//#define pf push_front
//#define ppb pop_back
//#define ppf pop_front
#define lwb lower_bound
#define upb upper_bound
#define F first
#define S second
//#define FOR(i,j,k) for(int i = j; i < (int)(k); i++)
//#define FORV(i, v) FOR(i, 0, ((v).size()))
//#define sz(a) (int)((a).size())
//#define all(a) a.begin() , a.end()
#define coud(a,b) cout<<fixed << setprecision((b)) << (a)
#define L(x) ((x)<<1)
#define R(x) (((x)<<1)+1)
//#define int long long
#define double long double
#define joon ios :: sync_with_stdio(false)
//#define cin fin
//#define cout fout
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
const double pi = acos(-1);
const double eps = 1e-7;
const int MAXN=50000+100;
const int INF=1000*1000*1000;
priority_queue< pair<int,int> , vector< pair<int,int> > , less<pair<int,int> > > q;
vector< pair<int,int> > N[MAXN];
int ki[MAXN];
bool mark[MAXN],isk[MAXN];
int anss[MAXN],d[MAXN];
int ans,k,n,m,t;
void dijkstra(int v)
{
q.push( make_pair(d[v],v) );
while( !q.empty() )
{
pair<int,int> u=q.top();
q.pop();
if( mark[ u.S ]==0 && u.F < k )
{
mark[ u.S ]=1;
ans++;
}
for(int i=0;i<(int)N[ u.S ].size();i++)
if( d[ N[ u.S ][i].F ] > d[u.S] + N[ u.S ][i].S )
{
d[ N[ u.S ][i].F ] = d[u.S] + N[ u.S ][i].S;
if( d[ N[ u.S ][i].F ] < k )
q.push( make_pair( d[ N[ u.S ][i].F ] , N[ u.S ][i].F ) );
}
}
}
int main()
{
joon;
cin.tie(0);
cin>>n>>m>>t>>k;
for(int i=1;i<=m;i++)
{
int v,u,w;
cin>>v>>u>>w;
N[v].push_back( make_pair(u,w) );
N[u].push_back( make_pair(v,w) );
}
for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