#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;
 
vector < pair<int,int> > v[105];
int in[105][105],dp[105][105];
 
int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
 
    int N,M,n,m,i,j,C,a,b,c;
    while(scanf(" %d %d %d",&N,&M,&C)==3 && (M+N+C)){
        for(n=1;n<=N;n++)
            v[n].clear();
        for(m=0;m<M;m++){
            scanf(" %d %d %d",&a,&b,&c);
            v[a].push_back(make_pair(b,c));
        }
        memset(in,0,sizeof(in));
        queue <int> q;
        for(i=0;i<105;i++)
            for(j=0;j<105;j++)
                dp[i][j] = 1e9;
        q.push(1);
        q.push(0);
        dp[1][0] = 0;
        while(!q.empty()){
            int now = q.front();    q.pop();
            int cnt = q.front();    q.pop();
            in[now][cnt] = 0;
            /*if(now==10 && cnt==0){
                printf("==%d\n",dp[N][cnt]);
            }*/
            if(now==N)
                continue;
            if(cnt==N)
                continue;
            for(i=0;i<v[now].size();i++){
                if(dp[now][cnt] + v[now][i].second < dp[v[now][i].first][cnt]){
                    dp[v[now][i].first][cnt] = dp[now][cnt] + v[now][i].second;
                    //printf("-> %d %d %d\n",v[now][i].first,cnt,dp[v[now][i].first][cnt]);
                    if(in[v[now][i].first][cnt] == 0){
                        in[v[now][i].first][cnt] = 1;
                        q.push(v[now][i].first);
                        q.push(cnt);
                    }
                }
                if(dp[now][cnt] < dp[v[now][i].first][cnt+1]){
                    dp[v[now][i].first][cnt+1] = dp[now][cnt];
                    //printf("==> %d %d %d\n",v[now][i].first,cnt+1,dp[v[now][i].first][cnt+1]);
                    if(in[v[now][i].first][cnt+1] == 0){
                        in[v[now][i].first][cnt+1] = 1;
                        q.push(v[now][i].first);
                        q.push(cnt+1);
                    }
                }
            }
        }
        //printf("N = %d %d\n",N,dp[N][0]);
        for(i=0;i<=N;i++)
            if(dp[N][i] <= C)
                break;
        printf("%d\n",i);
    }
 
    return 0;
}