//#pragma GCC target("avx2") //#pragma GCC optimize("O3") //#pragma GCC optimize("unroll-loops") #include using namespace std; using ll=long long; using ull=unsigned long long; using pii=pair; using pil=pair; using pli=pair; using pll=pair; template using vvector=vector>; template using vvvector=vector>; template using vvvvector=vector>; #define Vector(type, name, ...) vector name(__VA_ARGS__) #define VVector(type, name, h, ...) \ vector> name(h, vector(__VA_ARGS__)) #define VVVector(type, name, h, w, ...) \ vector>> name( \ h, vector>(w, vector(__VA_ARGS__))) #define VVVVector(type, name, a, b, c, ...) \ vector>>> name( \ a, vector>>( \ b, vector>(c, vector(__VA_ARGS__)))) #define OVERLOAD_REP(_1, _2, _3, _4, name, ...) name #define REP1(n) for (int _ = 0; _ < (int)(n); _++) #define REP2(i,n) for (int i = 0; i < (int)(n); i++) #define REP3(i,l,r) for (int i = (int)(l); i < (int)(r); i++) #define REP4(i,l,r,d) for (int i = (int)(l); (int)(d) > 0 ? i < (int)(r) : i > (int)(r); i += (int)(d)) #define rep(...) OVERLOAD_REP(__VA_ARGS__,REP4,REP3,REP2,REP1)(__VA_ARGS__) #define OVERLOAD_REPll(_1, _2, _3, _4, name, ...) name #define REP1ll(n) for (ll _ = 0; _ < (ll)(n); _++) #define REP2ll(i,n) for (ll i = 0; i < (ll)(n); i++) #define REP3ll(i,l,r) for (ll i = (ll)(l); i < (ll)(r); i++) #define REP4ll(i,l,r,d) for (ll i = (ll)(l); (ll)(d) > 0 ? i < (ll)(r) : i > (ll)(r); i += (ll)(d)) #define repll(...) OVERLOAD_REPll(__VA_ARGS__,REP4ll,REP3ll,REP2ll,REP1ll)(__VA_ARGS__) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() template void chmin(T &a,T b){ if(a>b){ a=b; } } template void chmax(T &a,T b){ if(a0;NN/=10){ retu+=(char)(NN%10)+'0'; } reverse(retu.begin(),retu.end()); } os< ostream &operator<< (ostream &os, pair &p){ if(&os==&cerr){return os << "(" << p.first << ", " << p.second << ")";} return os << p.first << " " << p.second; } template basic_ostream &operator<<(basic_ostream &os, const Container &x) { bool first=true; if(&os==&cerr){os<<"[";} for(auto &y:x){ if(&os==&cerr){os<<(first?"":", ")< ostream &operator<<(ostream &os, const priority_queue &pq) { auto _pq = pq; vector retu; while(!empty(_pq)) retu.emplace_back(_pq.top()), _pq.pop(); return os << retu; } namespace aux { template struct tp { static void output(ostream &os, const T &v) { os << get(v) << (&os == &cerr ? ", " : " "); tp::output(os, v); } }; template struct tp { static void output(ostream &os, const T &v) { os << get(v); } }; } template ostream &operator<<(ostream &os, const tuple &t) { if(&os == &cerr) { os << '('; } aux::tp, 0, sizeof...(Ts) - 1>::output(os, t); if(&os == &cerr) { os << ')'; } return os; } template Container operator+(Container x,T v) { for(auto &y:x){ y=y+v; } return x; } template Container &operator+=(Container &x,T v) { for(auto &y:x){ y+=v; } return x; } string Yes(bool bl){ return bl?"Yes":"No"; }; string No(bool bl){ return Yes(!bl); }; string YES(bool bl){ return bl?"YES":"NO"; }; string NO(bool bl){ return YES(!bl); }; long long pow_mod(long long x,long long n,long long mod){ if(n==0){ return 1LL; } if(n%2==0){ long long p=pow_mod(x,n/2,mod); return p*p%mod; } else{ long long p=pow_mod(x,n/2,mod); p*=p; p%=mod; p*=x; return p%mod; } } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int N,M,P; ll Y; cin>>N>>M>>P>>Y; VVector(pii,graph,N); rep(m,M){ int A,B,C; cin>>A>>B>>C; A-=1;B-=1; graph[A].emplace_back(B,C); graph[B].emplace_back(A,C); } ll inf=1ll<<60; Vector(ll,dist,N,inf); priority_queue que={}; que.emplace(0,0); dist[0]=0; while(!que.empty()){ auto [dx,x]=que.top(); if(dist[x]>d>>e; d-=1; ans=max(ans,max(Y-dist[d],0ll)/e); } cout<