#include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair P; #define fi first #define se second #define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++) #define rep(i,n) repl(i,0,n) #define all(x) (x).begin(),(x).end() #define dbg(x) cout<<#x"="<y?x:y) #define mmin(x,y) (x rs[100010]; ll dp[100010][2]; int main(){ cin.tie(0); ios::sync_with_stdio(false); cin>>N>>M>>A; rep(i,M){ ll a,b,c; cin>>a>>b>>c; a--; rs[b].push_back(P(a,c)); } rep(i,N+1)dp[i][0]=dp[i][1]=-INF; dp[0][1]=0; repl(i,1,N+1){ for(P r : rs[i]){ if(i