#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;

const int maxn=100;
const int maxm=1000;
const int inf=100000008;


int n,m,c,u,v,p,en;
int s[maxn+10],inq[maxn+10],dis[maxn+10][maxn+10];

struct edge{
	int u,v,l,nxt;
}es[maxm+10];

void add_edge(int u,int v,int p){
	es[++en].u=u;
	es[en].v=v;
	es[en].l=p;
	es[en].nxt=s[u];
	s[u]=en;
}
void spfa(int a){
	for(int i=1;i<=n;i++) dis[i][0]=inf;
	memset(inq,0,sizeof(inq));
	queue<int> q;
	dis[1][0]=0;
	inq[1]=1;
	q.push(1);
	while(!q.empty()){
		int p=q.front();
		for(int i=s[p];i;i=es[i].nxt)
			if(dis[p][0]+es[i].l<dis[es[i].v][0]){
				dis[es[i].v][0]=dis[p][0]+es[i].l;
				if(!inq[es[i].v]){
					inq[es[i].v]=1;
					q.push(es[i].v);
				}
			}
		q.pop();
		inq[p]=0;
	}
}

void spf(int a,int d){
	for(int i=1;i<=n;i++) dis[i][d]=inf;
	memset(inq,0,sizeof(inq));
	queue<int> q;
	for(int i=1;i<=en;i++)
		if(dis[es[i].u][d-1]<dis[es[i].v][d]){
			dis[es[i].v][d]=dis[es[i].u][d-1];
			if(!inq[es[i].v]){
				inq[es[i].v]=1;
				q.push(es[i].v);
			}
		}
	while(!q.empty()){
		int p=q.front();
		for(int i=s[p];i;i=es[i].nxt)
			if(dis[p][d]+es[i].l<dis[es[i].v][d]){
				dis[es[i].v][d]=dis[p][d]+es[i].l;
				if(!inq[es[i].v]){
					inq[es[i].v]=1;
					q.push(es[i].v);
				}
			}
		q.pop();
		inq[p]=0;
	}
}

int main(){
	scanf("%d%d%d",&n,&m,&c);
	while(n+m+c){
		en=0;
		memset(s,0,sizeof(s));
		for(int i=0;i<m;i++){
			scanf("%d%d%d",&u,&v,&p);
			add_edge(u,v,p);
		}
		int ans=0;
		spfa(1);
		while(dis[n][ans]>c)
			spf(1,++ans);
		printf("%d\n",ans);
		scanf("%d%d%d",&n,&m,&c);
	}
	return 0;
}