#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef pair P; typedef long long ll; typedef long double ld; const int inf=1e9+7; const ll longinf=1LL<<60; #define REP(i,m,n) for(ll i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) #define F first #define S second constexpr char ln = '\n'; const int mx=200010; const ll mod=1e9+7; struct mint { ll x; // typedef long long ll; mint(ll x=0):x((x%mod+mod)%mod){} mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; } mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { mint res(*this); return res+=a; } mint operator-(const mint a) const { mint res(*this); return res-=a; } mint operator*(const mint a) const { mint res(*this); return res*=a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t>>1); a *= a; if (t&1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod-2); } mint& operator/=(const mint a) { return (*this) *= a.inv(); } mint operator/(const mint a) const { mint res(*this); return res/=a; } }; int main(){ int n,m,l; cin >> n >> m >> l; vector

v[310]; rep(i,m){ int x,y,c; cin >> x >> y >> c; x--; y--; v[x].emplace_back(y,c); } vector>> dp(310, vector>(310, vector(310,0))); rep(i,300){ dp[0][i][0] = 1; } rep(i,n)rep(j,300)rep(k,l+1){ for(auto it:v[j]){ dp[i+1][it.S][k+it.S] += dp[i][j][k]; } } mint ans = 0; rep(i,300){ ans += dp[n][i][l]; } cout << ans.x << ln; return 0; }