#include <bits/stdc++.h>   using namespace std;   int main() {     ifstream in( date.in );     ofstream out( date.out );     long long nr2, k, rez[4001], con = 0, nr, n, pli[4001], plp[4001], inc[4001],                                  i, j;     cin >> n;     for (i = 1; i <= n; i++) cin >> pli[i] >> plp[i] >> inc[i];     for (i = 1; i <= n; i++) {       nr = nr2 = 0;       if (inc[i] >= 0) {         rez[++con] = i;         nr = pli[i];         for (j = i + 1; nr > 0 && j <= n; j++) {           if (inc[j] >= 0) {             inc[j] -= nr--;           } else {             if (pli[j]) {               inc[j] -= nr;               pli[j] = 0;               nr2 = plp[j];               for (k = j + 1; k <= n; k++) inc[k] -= nr2;             }           }         }       } else {         if (pli[i]) {           pli[i] = 0;           nr2 = plp[i];           for (k = i + 1; k <= n; k++) inc[k] -= nr2;         }       }     }     cout << con <<   n ;     for (j = 1; j <= con; j++) cout << rez[j] <<    ;     return 0;   }   