#include #include using namespace std; const long mod=1e9+7; long dp[301][301][301]; int N,M,K; vector >G[301]; main() { cin>>N>>M>>K; for(int i=0;i>u>>v>>c; G[u].push_back(make_pair(v,c)); } for(int i=1;i<=300;i++)dp[1][i][0]=1; for(int i=1;ie:G[j])if(k+e.second<=K)(dp[i+1][e.first][k+e.second]+=dp[i][j][k])%=mod; } long ans=0; for(int i=1;i<=300;i++)ans+=dp[N][i][K]; cout<