#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
struct st{
  int v,s,d;
  st(){}
  st(int v,int s,int d):v(v),s(s),d(d){}
  bool operator<(const st a)const{
    return d>a.d;
  }
};
int dp[111][111];
signed main(){
  int n,m,c;
  while(cin>>n>>m>>c,n||m||c){
    //cout<<n<<" "<<m<<" "<<c<<endl;;
    vector<P> G[n];
    for(int i=0;i<m;i++){
      int u,v,d;
      cin>>u>>v>>d;
      u--;v--;
      G[u].emplace_back(v,d);
      //G[v].emplace_back(u,d);
    }
    int INF=1LL<<55LL;
    for(int i=0;i<111;i++)
      for(int j=0;j<111;j++)
	dp[i][j]=INF;
    priority_queue<st> q;
    dp[0][0]=0;
    q.emplace(0,0,0);
    while(!q.empty()){
      st p=q.top();q.pop();
      int v=p.v,s=p.s,d=p.d;
      if(dp[v][s]<d) continue;
      //cout<<v<<" "<<s<<":"<<d<<endl;
      for(P e:G[v]){
	{
	  int nv=e.first,ns=s,nd=d+e.second;
	  if(dp[nv][ns]>nd){
	    dp[nv][ns]=nd;
	    q.emplace(nv,ns,nd);
	  }
	}
	if(s<n){
	  int nv=e.first,ns=s+1,nd=d;
	  if(dp[nv][ns]>nd){
	    dp[nv][ns]=nd;
	    q.emplace(nv,ns,nd);
	  }
	}
      }
    }
    int ans=n;
    for(int i=0;i<=n;i++){
      //cout<<i<<":"<<dp[n-1][i]<<endl;
      if(dp[n-1][i]<=c){
	ans=i;
	break;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}