#include #include #include using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll n,m,c; cin>>n>>m>>c; vector>> g(n,vector>(n,make_pair(-1,-1))); for(int i = 0;i>u>>v>>r>>w; u--;v--; pair now = make_pair(r,w); g[u][v] = g[v][u] = now; } vector> dp(n,vector(c+1,-1)); dp[n-1][0] = 0; for(int i = 0;i<=c;i++) dp[n-1][i] = i; for(int i = 1;i<=c;i++){ for(int j = 0;ji) continue; ll nj = i - cost; dp[j][i] = max(dp[j][i],dp[k][nj]); } } } for(int i = 1;i<=c;i++) cout<