func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 105;   const int oo = 1000000000;   long long n, k;   long long a[N], b[N], c[N];   long long module = 1000000007;   void print(vector<vector<long long> > mat) {     for (int j = 0; j < mat.size(); j++) {       for (int k = 0; k < mat[j].size(); k++) cout << mat[j][k] <<    ;       cout << endl;     }   }   vector<vector<long long> > mul(vector<vector<long long> > mat1,                                  vector<vector<long long> > mat2) {     vector<vector<long long> > res;     for (int i = 0; i < mat1.size(); i++) {       vector<long long> row;       for (int k = 0; k < mat2[0].size(); k++) {         long long temp = 0;         for (int j = 0; j < mat1[0].size(); j++) {           temp = (temp + mat1[i][j] * mat2[j][k] % module) % module;         }         row.push_back(temp);       }       res.push_back(row);     }     return res;   }   vector<vector<long long> > pow(vector<vector<long long> > mat, long long t) {     vector<vector<long long> > res;     if (t == 0) {       for (int i = 0; i < 16; i++) {         vector<long long> row;         for (int j = 0; j < 16; j++) {           if (i == j)             row.push_back(1);           else             row.push_back(0);         }         res.push_back(row);       }       return res;     }     res = pow(mat, t / 2);     res = mul(res, res);     if (t % 2 == 0)       return res;     else       return mul(mat, res);   }   int main() {     cin >> n >> k;     for (int i = 1; i <= n; i++) cin >> a[i] >> b[i] >> c[i];     vector<vector<long long> > base;     vector<long long> row;     row.push_back(1);     base.push_back(row);     for (int i = 1; i < 16; i++) {       row.resize(0);       row.push_back(0);       base.push_back(row);     }     base.push_back(row);     for (int i = 1; i <= n; i++) {       long long dist = 0;       if (i == n)         dist = k - a[i];       else         dist = b[i] - a[i];       vector<vector<long long> > mat;       for (int j = 0; j < 16; j++) {         vector<long long> row;         for (int k = 0; k < 16; k++) {           if (j <= c[i] && k <= c[i] && (k == j || k == j - 1 || k == j + 1))             row.push_back(1);           else             row.push_back(0);         }         mat.push_back(row);       }       base = mul(pow(mat, dist), base);     }     cout << base[0][0];     return 0;   }   