#include <bits/stdc++.h>
using namespace std;
long long n, v[5000], d[5000], p[5000], cnt;
queue<int> cry;
bool leave[5000];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> v[i] >> d[i] >> p[i];
  for (int i = 0; i < n; ++i)
    if (!leave[i]) {
      for (int j = i + 1; j < n; ++j) {
        if (v[i] > 0 && !leave[j])
          p[j] -= (v[i]--);
        else if (v[i] == 0)
          break;
        if (p[j] < 0 && !leave[j]) {
          cry.push(j);
          leave[j] = 1;
        }
      }
      while (!cry.empty()) {
        for (int j = cry.front() + 1; j < n; ++j) {
          p[j] -= d[cry.front()];
          if (p[j] < 0 && !leave[j]) {
            cry.push(j);
            leave[j] = 1;
          }
        }
        cry.pop();
      }
    }
  for (int i = 0; i < n; ++i)
    if (p[i] >= 0) ++cnt;
  cout << cnt << '\n';
  for (int i = 0; i < n; ++i)
    if (p[i] >= 0) cout << i + 1 << ' ';
}
