#include<cstdio>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const int inf=1<<28;
int n,m,C;
int d[100][100],e[100][100];
bool v[100];

int main()
{
	while(scanf("%d%d%d",&n,&m,&C),n){
		rep(i,n)rep(j,n)e[i][j]=d[i][j]=inf;
		rep(i,m){
			int a,b,c; scanf("%d%d%d",&a,&b,&c);
			e[a-1][b-1]=c;
		}
		d[0][0]=0;
		rep(i,n){
			rep(j,n)v[j]=0;
			rep(j,n){
				int mn=inf,c=0;
				rep(k,n)if(!v[k]&&d[i][k]<mn)mn=d[i][k],c=k;
				v[c]=1;
				if(c==n-1&&mn<=C){
					printf("%d\n",i); goto END;
				}
				rep(k,n)if(e[c][k]!=inf){
					if(!v[k]&&d[i][k]>d[i][c]+e[c][k])d[i][k]=d[i][c]+e[c][k];
					if(d[i+1][k]>d[i][c])d[i+1][k]=d[i][c];
				}
			}
		}
		END:;
	}
	return 0;
}