#include <bits/stdc++.h>
#define N 101
#define INF (1e9)
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> PP;
vector<P> G[N];
int n,m,C;

int dijkstra(){
  vector<vector<int> >D(N,vector<int>(N,INF));
  priority_queue<PP,vector<PP>,greater<PP> > Q;
  Q.push(PP(0,P(0,0)));
  D[0][0] = 0;
  while(!Q.empty()){
    PP t=Q.top();Q.pop();
    int cost = t.first;
    int pos = t.second.first;
    int cnt = t.second.second;
    if(D[pos][cnt]<cost) continue;
    
    for(int i=0;i<G[pos].size();i++){
      int npos = G[pos][i].second;
      int ncost= cost+G[pos][i].first;
      if(D[npos][cnt]>ncost) Q.push(PP(ncost,P(npos,cnt))),D[npos][cnt]=ncost;
      if(cnt+1<N&&D[npos][cnt+1]>cost) Q.push(PP(cost,P(npos,cnt+1))),D[npos][cnt+1]=cost;
    }
  }
  for(int i=0;i<N;i++)if(D[n-1][i]<= C) return i;
}

int main(){
  while(1){
  cin>>n>>m>>C;
  if(!n&&!m&&!C) break;
  for(int i=0;i<N;i++)G[i].clear();
  for(int i=0,a,b,c;i<m;i++)cin>>a>>b>>c,G[a-1].push_back(P(c,b-1));
  cout<<dijkstra()<<endl;
  }
  return 0;
}